JBoss Cache SVN: r7356 - searchable/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-04 12:46:44 -0500 (Sun, 04 Jan 2009)
New Revision: 7356
Added:
searchable/tags/1.0.0.GA/
Log:
JBoss Cache Searchable Release Script: Tagging 1.0.0.GA
Copied: searchable/tags/1.0.0.GA (from rev 7355, searchable/trunk)
16 years
JBoss Cache SVN: r7355 - in searchable/trunk/src: test/java/org/jboss/cache/search/blackbox and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2009-01-04 12:43:15 -0500 (Sun, 04 Jan 2009)
New Revision: 7355
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/PojoTransactionContext.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Commented out pojo classes ...
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/PojoTransactionContext.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/PojoTransactionContext.java 2009-01-04 17:38:05 UTC (rev 7354)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/PojoTransactionContext.java 2009-01-04 17:43:15 UTC (rev 7355)
@@ -1,72 +1,72 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.cache.search;
-
-import org.hibernate.search.backend.TransactionContext;
-import org.jboss.cache.pojo.notification.event.Event;
-
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-
-/**
- * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
- */
-public class PojoTransactionContext implements TransactionContext
-{
- Event event;
-
- public PojoTransactionContext(Event event)
- {
- if (event == null) throw new NullPointerException("event cannot be null");
- this.event = event;
-
- }
- public boolean isTransactionInProgress()
- {
- return (event.getContext().getTransaction() != null);
-
- }
-
- public Object getTransactionIdentifier()
- {
- return event.getContext().getTransaction();
- }
-
- public void registerSynchronization(Synchronization synchronization)
- {
- Transaction transaction = event.getContext().getTransaction();
-
- if (transaction != null)
- {
-
- try
- {
- transaction.registerSynchronization(synchronization);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- }
-}
+///*
+// * JBoss, Home of Professional Open Source
+// * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
+// * by the @authors tag. See the copyright.txt in the distribution for a
+// * full listing of individual contributors.
+// *
+// * This is free software; you can redistribute it and/or modify it
+// * under the terms of the GNU Lesser General Public License as
+// * published by the Free Software Foundation; either version 2.1 of
+// * the License, or (at your option) any later version.
+// *
+// * This software is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this software; if not, write to the Free
+// * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+// * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+// */
+//
+//package org.jboss.cache.search;
+//
+//import org.hibernate.search.backend.TransactionContext;
+//import org.jboss.cache.pojo.notification.event.Event;
+//
+//import javax.transaction.Synchronization;
+//import javax.transaction.Transaction;
+//
+///**
+// * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+// */
+//public class PojoTransactionContext implements TransactionContext
+//{
+// Event event;
+//
+// public PojoTransactionContext(Event event)
+// {
+// if (event == null) throw new NullPointerException("event cannot be null");
+// this.event = event;
+//
+// }
+// public boolean isTransactionInProgress()
+// {
+// return (event.getContext().getTransaction() != null);
+//
+// }
+//
+// public Object getTransactionIdentifier()
+// {
+// return event.getContext().getTransaction();
+// }
+//
+// public void registerSynchronization(Synchronization synchronization)
+// {
+// Transaction transaction = event.getContext().getTransaction();
+//
+// if (transaction != null)
+// {
+//
+// try
+// {
+// transaction.registerSynchronization(synchronization);
+// }
+// catch (Exception e)
+// {
+// throw new RuntimeException(e);
+// }
+// }
+// }
+//}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2009-01-04 17:38:05 UTC (rev 7354)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2009-01-04 17:43:15 UTC (rev 7355)
@@ -27,7 +27,6 @@
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheStatus;
-import org.jboss.cache.pojo.PojoCache;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -106,65 +105,64 @@
}
- /**
- * This method creates a searchable cache as well but requires the properties object.
- *
- * @param pojo - the pojoCache
- * @param properties - java.util.properties
- * @param classes - a class array
- * @return a SearchableCache
- */
+// /**
+// * This method creates a searchable cache as well but requires the properties object.
+// *
+// * @param pojo - the pojoCache
+// * @param properties - java.util.properties
+// * @param classes - a class array
+// * @return a SearchableCache
+// */
- public SearchableCache createSearchableCache(PojoCache pojo, Properties properties, Class... classes)
- {
-
- System.out.println("create searchable cache called with pojo cache");
- //TODO: Ask Manik and/or Jason if there is a way to directly check if the pojo cache is started or not
- validateClasses(classes);
-
- Cache coreCache = pojo.getCache();
-
- if (coreCache.getCacheStatus() != CacheStatus.STARTED)
- {
- if (log.isInfoEnabled()) log.info("Cache not started. Starting cache first.");
- pojo.start();
- }
-
- if (classes.length == 0)
- {
- if (log.isWarnEnabled()) log.warn("You haven't passed in any classes to index. Is this an error?");
- }
-
- // step 1: create hibernate search searchFactory
- SearchConfiguration cfg = new SearchableCacheConfiguration(classes, properties);
- // set classes in the cfg
-
- SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
-
- //Now create the pojoListener
+// public SearchableCache createSearchableCache(PojoCache pojo, Properties properties, Class... classes)
+// {
+//
+// System.out.println("create searchable cache called with pojo cache");
+// //TODO: Ask Manik and/or Jason if there is a way to directly check if the pojo cache is started or not
+// validateClasses(classes);
+//
+// Cache coreCache = pojo.getCache();
+//
+// if (coreCache.getCacheStatus() != CacheStatus.STARTED)
+// {
+// if (log.isInfoEnabled()) log.info("Cache not started. Starting cache first.");
+// pojo.start();
+// }
+//
+// if (classes.length == 0)
+// {
+// if (log.isWarnEnabled()) log.warn("You haven't passed in any classes to index. Is this an error?");
+// }
+//
+// // step 1: create hibernate search searchFactory
+// SearchConfiguration cfg = new SearchableCacheConfiguration(classes, properties);
+// // set classes in the cfg
+//
+// SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
+//
+// //Now create the pojoListener
// SearchablePojoListener pojoListener = new SearchablePojoListener(searchFactory);
// pojo.addListener(pojoListener);
// pojo.getCache().addCacheListener(pojoListener);
+//
+// SearchableCache sc = new SearchableCacheImpl(coreCache, searchFactory);
+// return sc;
+// }
- //TODO: - This could be a break point. But it should not be.
- SearchableCache sc = new SearchableCacheImpl(coreCache, searchFactory);
- return sc;
- }
+// /**
+// * Creates a searchable cache from a cache object and a class array, without the properties object.
+// *
+// * @param pojo - the pojoCache
+// * @param classes - Class array to be added
+// * @return a SearchableCache
+// */
+//
+//
+// public SearchableCache createSearchableCache(PojoCache pojo, Class... classes)
+// {
+// return createSearchableCache(pojo, null, classes);
+// }
- /**
- * Creates a searchable cache from a cache object and a class array, without the properties object.
- *
- * @param pojo - the pojoCache
- * @param classes - Class array to be added
- * @return a SearchableCache
- */
-
-
- public SearchableCache createSearchableCache(PojoCache pojo, Class... classes)
- {
- return createSearchableCache(pojo, null, classes);
- }
-
//This is to check that both the @ProvidedId is present and the the @DocumentId is not present. This is because
// don't want both of these 2 annotations used at the same time.
private void validateClasses(Class... classes)
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2009-01-04 17:38:05 UTC (rev 7354)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2009-01-04 17:43:15 UTC (rev 7355)
@@ -1,193 +1,193 @@
-package org.jboss.cache.search.blackbox;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.search.CacheQuery;
-import org.jboss.cache.search.SearchableCache;
-import org.jboss.cache.search.SearchableCacheFactory;
-import org.jboss.cache.search.QueryResultIterator;
-import org.jboss.cache.search.helper.IndexCleanUp;
-import org.jboss.cache.search.test.Person;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.List;
-import java.util.Iterator;
-
-/**
- * Same as LocalCacheTest except that you will use a POJO Cache instead and use pojoCache.attach() ad pojoCache.detach()
- * instead of cache.put() and cache.remove().
- * <p/>
- *
- * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
- */
-
-@Test(groups = "functional", enabled = false)
-public class LocalPOJOCacheTest
-{
- SearchableCache searchableCache;
- PojoCache pojo;
- Person person1;
- Person person2;
- Person person3;
- Person person4;
- QueryParser queryParser;
- Query luceneQuery;
- CacheQuery cacheQuery;
- List found;
- private static final Log log = LogFactory.getLog(LocalPOJOCacheTest.class);
-
-
- @BeforeMethod
- public void setUp()
- {
- boolean toStart = false;
- pojo = PojoCacheFactory.createCache(new Configuration(), toStart);
- pojo.start(); // if toStart above is true, it will starts the cache automatically.
- searchableCache = new SearchableCacheFactory().createSearchableCache(pojo, Person.class);
-
- person1 = new Person();
- person1.setName("Navin Surtani");
- person1.setBlurb("Likes playing WoW");
-
- person2 = new Person();
- person2.setName("BigGoat");
- person2.setBlurb("Eats grass");
-
- person3 = new Person();
- person3.setName("MiniGoat");
- person3.setBlurb("Eats cheese");
-
- pojo.attach("/a/b/c", person1);
- pojo.attach("/a/b/d", person2);
- pojo.attach("/c/a/t", person3);
-
-
- }
-
- @AfterMethod
- public void tearDown()
- {
- if (pojo != null) pojo.stop();
- if (searchableCache != null) searchableCache.stop();
- IndexCleanUp.cleanUpIndexes();
- }
-
- public void testSimple() throws ParseException
- {
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("playing");
- cacheQuery = searchableCache.createQuery(luceneQuery);
-
- QueryResultIterator found = cacheQuery.iterator();
- found.first();
- System.out.println("First object is " + found.next());
- }
-
- public void testMultipleResults() throws ParseException
- {
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("Eats");
- cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
- System.out.println("size is " + found.size());
- assert found.size() == 2;
-
- System.out.println("object 0 is " + found.get(0));
- System.out.println("object 1 is " + found.get(1));
- assert !found.get(1).equals(person2);
- assert !found.get(0).equals(person3);
-
- }
-
- public void testModified() throws ParseException
- {
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("playing");
- cacheQuery = searchableCache.createQuery(luceneQuery);
-
- found = cacheQuery.list();
-
- assert found.size() == 1;
-// assert found.get(0).equals(person1);
-
- person1.setBlurb("Likes pizza");
-
- pojo.attach(Fqn.fromString("/a/b/c/"), person1);
-
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("pizza");
- cacheQuery = searchableCache.createQuery(luceneQuery);
-
- found = cacheQuery.list();
-
- assert found.size() == 1;
-// assert found.get(0).equals(person1);
- }
-
- public void testAdded() throws ParseException
- {
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("eats");
- cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
- assert found.size() == 2 : "Size of list should be 2";
- assert found.contains(person2);
- assert found.contains(person3);
- assert !found.contains(person4) : "This should not contain object person4";
-
- person4 = new Person();
- person4.setName("MightyGoat");
- person4.setBlurb("Also eats grass");
-
- pojo.attach(Fqn.fromString("/r/a/m/"), person4);
-
- luceneQuery = queryParser.parse("eats");
- cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
- assert found.size() == 3 : "Size of list should be 3";
- assert found.contains(person2);
- assert found.contains(person3);
- assert found.contains(person4) : "This should now contain object person4";
- }
-
- public void testRemoved() throws ParseException
- {
- queryParser = new QueryParser("blurb", new StandardAnalyzer());
- luceneQuery = queryParser.parse("eats");
- cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
- assert found.size() == 2;
- assert found.contains(person2);
- assert found.contains(person3) : "This should still contain object person3";
-
- pojo.detach("/a/b/d");
-
- luceneQuery = queryParser.parse("eats");
- cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
- assert found.size() == 1;
- assert found.contains(person2);
- assert !found.contains(person3) : "The search should not return person3";
-
-
- }
-
-}
-
-
-
+//package org.jboss.cache.search.blackbox;
+//
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//import org.apache.lucene.analysis.standard.StandardAnalyzer;
+//import org.apache.lucene.queryParser.ParseException;
+//import org.apache.lucene.queryParser.QueryParser;
+//import org.apache.lucene.search.Query;
+//import org.jboss.cache.Fqn;
+//import org.jboss.cache.config.Configuration;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.pojo.PojoCacheFactory;
+//import org.jboss.cache.search.CacheQuery;
+//import org.jboss.cache.search.SearchableCache;
+//import org.jboss.cache.search.SearchableCacheFactory;
+//import org.jboss.cache.search.QueryResultIterator;
+//import org.jboss.cache.search.helper.IndexCleanUp;
+//import org.jboss.cache.search.test.Person;
+//import org.testng.annotations.AfterMethod;
+//import org.testng.annotations.BeforeMethod;
+//import org.testng.annotations.Test;
+//
+//import java.util.List;
+//import java.util.Iterator;
+//
+///**
+// * Same as LocalCacheTest except that you will use a POJO Cache instead and use pojoCache.attach() ad pojoCache.detach()
+// * instead of cache.put() and cache.remove().
+// * <p/>
+// *
+// * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+// */
+//
+//@Test(groups = "functional", enabled = false)
+//public class LocalPOJOCacheTest
+//{
+// SearchableCache searchableCache;
+// PojoCache pojo;
+// Person person1;
+// Person person2;
+// Person person3;
+// Person person4;
+// QueryParser queryParser;
+// Query luceneQuery;
+// CacheQuery cacheQuery;
+// List found;
+// private static final Log log = LogFactory.getLog(LocalPOJOCacheTest.class);
+//
+//
+// @BeforeMethod
+// public void setUp()
+// {
+// boolean toStart = false;
+// pojo = PojoCacheFactory.createCache(new Configuration(), toStart);
+// pojo.start(); // if toStart above is true, it will starts the cache automatically.
+// searchableCache = new SearchableCacheFactory().createSearchableCache(pojo, Person.class);
+//
+// person1 = new Person();
+// person1.setName("Navin Surtani");
+// person1.setBlurb("Likes playing WoW");
+//
+// person2 = new Person();
+// person2.setName("BigGoat");
+// person2.setBlurb("Eats grass");
+//
+// person3 = new Person();
+// person3.setName("MiniGoat");
+// person3.setBlurb("Eats cheese");
+//
+// pojo.attach("/a/b/c", person1);
+// pojo.attach("/a/b/d", person2);
+// pojo.attach("/c/a/t", person3);
+//
+//
+// }
+//
+// @AfterMethod
+// public void tearDown()
+// {
+// if (pojo != null) pojo.stop();
+// if (searchableCache != null) searchableCache.stop();
+// IndexCleanUp.cleanUpIndexes();
+// }
+//
+// public void testSimple() throws ParseException
+// {
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("playing");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+// QueryResultIterator found = cacheQuery.iterator();
+// found.first();
+// System.out.println("First object is " + found.next());
+// }
+//
+// public void testMultipleResults() throws ParseException
+// {
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("Eats");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+// found = cacheQuery.list();
+//
+// System.out.println("size is " + found.size());
+// assert found.size() == 2;
+//
+// System.out.println("object 0 is " + found.get(0));
+// System.out.println("object 1 is " + found.get(1));
+// assert !found.get(1).equals(person2);
+// assert !found.get(0).equals(person3);
+//
+// }
+//
+// public void testModified() throws ParseException
+// {
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("playing");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+// found = cacheQuery.list();
+//
+// assert found.size() == 1;
+//// assert found.get(0).equals(person1);
+//
+// person1.setBlurb("Likes pizza");
+//
+// pojo.attach(Fqn.fromString("/a/b/c/"), person1);
+//
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("pizza");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+// found = cacheQuery.list();
+//
+// assert found.size() == 1;
+//// assert found.get(0).equals(person1);
+// }
+//
+// public void testAdded() throws ParseException
+// {
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("eats");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+// found = cacheQuery.list();
+//
+// assert found.size() == 2 : "Size of list should be 2";
+// assert found.contains(person2);
+// assert found.contains(person3);
+// assert !found.contains(person4) : "This should not contain object person4";
+//
+// person4 = new Person();
+// person4.setName("MightyGoat");
+// person4.setBlurb("Also eats grass");
+//
+// pojo.attach(Fqn.fromString("/r/a/m/"), person4);
+//
+// luceneQuery = queryParser.parse("eats");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+// found = cacheQuery.list();
+//
+// assert found.size() == 3 : "Size of list should be 3";
+// assert found.contains(person2);
+// assert found.contains(person3);
+// assert found.contains(person4) : "This should now contain object person4";
+// }
+//
+// public void testRemoved() throws ParseException
+// {
+// queryParser = new QueryParser("blurb", new StandardAnalyzer());
+// luceneQuery = queryParser.parse("eats");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+// found = cacheQuery.list();
+//
+// assert found.size() == 2;
+// assert found.contains(person2);
+// assert found.contains(person3) : "This should still contain object person3";
+//
+// pojo.detach("/a/b/d");
+//
+// luceneQuery = queryParser.parse("eats");
+// cacheQuery = searchableCache.createQuery(luceneQuery);
+// found = cacheQuery.list();
+//
+// assert found.size() == 1;
+// assert found.contains(person2);
+// assert !found.contains(person3) : "The search should not return person3";
+//
+//
+// }
+//
+//}
+//
+//
+//
16 years
JBoss Cache SVN: r7354 - searchable/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-04 12:38:05 -0500 (Sun, 04 Jan 2009)
New Revision: 7354
Modified:
searchable/trunk/pom.xml
Log:
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2009-01-04 17:36:41 UTC (rev 7353)
+++ searchable/trunk/pom.xml 2009-01-04 17:38:05 UTC (rev 7354)
@@ -40,11 +40,14 @@
<version>1.1.1</version>
</dependency>
- <dependency>
+<!--
+ Temporarily commented out until the searchable cache is compatible with pojo cache
+
+ <dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-pojo</artifactId>
<version>3.0.0.GA</version>
- </dependency>
+ </dependency> -->
<!-- Test dependencies -->
16 years
JBoss Cache SVN: r7353 - searchable/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-04 12:36:41 -0500 (Sun, 04 Jan 2009)
New Revision: 7353
Removed:
searchable/tags/1.0.0.GA/
Log:
16 years
JBoss Cache SVN: r7352 - searchable/tags.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-04 12:27:15 -0500 (Sun, 04 Jan 2009)
New Revision: 7352
Added:
searchable/tags/1.0.0.GA/
Log:
JBoss Cache Searchable Release Script: Tagging 1.0.0.GA
Copied: searchable/tags/1.0.0.GA (from rev 7351, searchable/trunk)
16 years
JBoss Cache SVN: r7351 - searchable/trunk.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-01-04 12:24:36 -0500 (Sun, 04 Jan 2009)
New Revision: 7351
Added:
searchable/trunk/release-properties.sh
Modified:
searchable/trunk/release.sh
Log:
Added: searchable/trunk/release-properties.sh
===================================================================
--- searchable/trunk/release-properties.sh (rev 0)
+++ searchable/trunk/release-properties.sh 2009-01-04 17:24:36 UTC (rev 7351)
@@ -0,0 +1,17 @@
+#!/usr/bin/bash
+
+########################
+# Properties file that defines where things are for release
+# To be used with release.sh
+#
+# NOTE to committers: Edit this file based on your local environment and DO NOT check it into SVN.
+########################
+
+# This property defines where tagged versions of JBCS are checked out on the local file system
+localTags="/path/to/my/tags/dir"
+
+# This property defines where you have checked out the JBoss.org maven2 repository. Under this
+# directory, the release script will create org/jboss/cache/jbosscache-searchable/VERSION and
+# the release artifacts under that directory.
+localMvn="/path/to/maven2/repo"
+
Modified: searchable/trunk/release.sh
===================================================================
--- searchable/trunk/release.sh 2009-01-04 16:28:01 UTC (rev 7350)
+++ searchable/trunk/release.sh 2009-01-04 17:24:36 UTC (rev 7351)
@@ -7,15 +7,8 @@
# SVN tags on repo: -
svnTags="tags"
-# Local tags dir
-localTags="/Users/Navin/Code/JBossCacheSearchable/tags"
+source ./release-properties.sh
-# Local maven2 repo
-localMvn="/Users/Navin/Code/maven2_repo/org/jboss/cache/jbosscache-searchable"
-
-# Docs
-# docsDir="/Users/Navin/Code/ReleaseDocs"
-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Functions that will be called
16 years
JBoss Cache SVN: r7350 - in searchable/trunk/src: test/java/org/jboss/cache/search/blackbox and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2009-01-04 11:28:01 -0500 (Sun, 04 Jan 2009)
New Revision: 7350
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Commented out Pojo stuff again ...
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2009-01-04 16:28:01 UTC (rev 7350)
@@ -142,9 +142,9 @@
SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
//Now create the pojoListener
- SearchablePojoListener pojoListener = new SearchablePojoListener(searchFactory);
- pojo.addListener(pojoListener);
- pojo.getCache().addCacheListener(pojoListener);
+// SearchablePojoListener pojoListener = new SearchablePojoListener(searchFactory);
+// pojo.addListener(pojoListener);
+// pojo.getCache().addCacheListener(pojoListener);
//TODO: - This could be a break point. But it should not be.
SearchableCache sc = new SearchableCacheImpl(coreCache, searchFactory);
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java 2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java 2009-01-04 16:28:01 UTC (rev 7350)
@@ -1,156 +1,156 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.cache.search;
-
-import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.backend.TransactionContext;
-import org.hibernate.search.backend.Work;
-import org.hibernate.search.backend.WorkType;
-import org.hibernate.search.engine.SearchFactoryImplementor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.notifications.event.NodeCreatedEvent;
-import org.jboss.cache.notifications.annotation.NodeModified;
-import org.jboss.cache.notifications.annotation.CacheListener;
-import org.jboss.cache.notifications.annotation.NodeCreated;
-import org.jboss.cache.pojo.notification.annotation.*;
-import org.jboss.cache.pojo.notification.event.AttachedEvent;
-import org.jboss.cache.pojo.notification.event.DetachedEvent;
-import org.jboss.cache.pojo.notification.event.Event;
-import org.jboss.cache.pojo.notification.NotificationContext;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.impl.InternalHelper;
-import org.jboss.cache.Fqn;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.Transaction;
-
-/**
- * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
- */
-
-@PojoCacheListener
-@CacheListener
-public class SearchablePojoListener
-{
- private SearchFactoryImplementor searchFactory;
- private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
- private String pojoKey = "pojoKey";
-
- private ThreadLocal<Fqn> savedFqn = new ThreadLocal<Fqn>();
-
- public SearchablePojoListener(SearchFactoryImplementor searchFactory)
- {
- this.searchFactory = searchFactory;
- }
-
- @NodeModified
- public void handleNodeModified(NodeModifiedEvent nme)
- {
- if (!nme.isPre()) return;
- Fqn f = nme.getFqn();
- if(log.isDebugEnabled()) log.debug("Node modified called for Fqn " + f);
- if (InternalHelper.isInternalNode(f))
- {
- if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
- }
- else
- {
- savedFqn.set(f);
- if(log.isDebugEnabled()) log.debug("Saved Fqn to ThreadLocal.");
- }
- }
-
- @NodeCreated
- public void handleNodeKreated(NodeCreatedEvent nce)
- {
- if (!nce.isPre()) return;
- Fqn f = nce.getFqn();
- if(log.isDebugEnabled()) log.debug("Node kreated called for Fqn " + f);
- if (InternalHelper.isInternalNode(f))
- {
- if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
- }
- else
- {
- savedFqn.set(f);
- if(log.isDebugEnabled()) log.debug("savedFqn.set() called");
- }
- }
-
- /**
- * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
- *
- * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
- * @throws InvalidKeyException if an invalid key is given.
- */
-
- @Attached
- public void handleAttach(AttachedEvent event) throws InvalidKeyException
- {
- System.out.println("Pojocache.attach() called");
- Object added = event.getSource();
-
- System.out.println("the object is " + event.toString());
-
- NotificationContext notificationContext = event.getContext();
- System.out.println("notificationContext is " + notificationContext);
-
- PojoCache pojo = notificationContext.getPojoCache();
- System.out.println("pojo is " + pojo);
-
-// Fqn fqn = pojo.getInternalFqn(added);
- Fqn fqn = savedFqn.get();
- savedFqn.remove();
- System.out.println("Fqn is " + fqn);
-
-
- CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
- System.out.println("new CEI created" + cacheEntityId);
-
- TransactionContext ctx = new PojoTransactionContext(event);
- System.out.println("new ctx created" + ctx);
-
- searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
- }
-
- @Detached
- public void handleDetach(DetachedEvent event) throws InvalidKeyException
- {
- Object deleted = event.getSource();
- Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
-
- CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
-
- TransactionContext ctx = new PojoTransactionContext(event);
-
- searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
- }
-
- //TODO: Sort out updating Lucene for the following annotations: -
-// @FieldModified
-// @ListModified
-// @ArrayModified
-// @SetModified
-
-}
+///*
+// * JBoss, Home of Professional Open Source
+// * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
+// * by the @authors tag. See the copyright.txt in the distribution for a
+// * full listing of individual contributors.
+// *
+// * This is free software; you can redistribute it and/or modify it
+// * under the terms of the GNU Lesser General Public License as
+// * published by the Free Software Foundation; either version 2.1 of
+// * the License, or (at your option) any later version.
+// *
+// * This software is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this software; if not, write to the Free
+// * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+// * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+// */
+//
+//package org.jboss.cache.search;
+//
+//import org.hibernate.search.impl.SearchFactoryImpl;
+//import org.hibernate.search.backend.TransactionContext;
+//import org.hibernate.search.backend.Work;
+//import org.hibernate.search.backend.WorkType;
+//import org.hibernate.search.engine.SearchFactoryImplementor;
+//import org.jboss.cache.notifications.event.NodeModifiedEvent;
+//import org.jboss.cache.notifications.event.NodeCreatedEvent;
+//import org.jboss.cache.notifications.annotation.NodeModified;
+//import org.jboss.cache.notifications.annotation.CacheListener;
+//import org.jboss.cache.notifications.annotation.NodeCreated;
+//import org.jboss.cache.pojo.notification.annotation.*;
+//import org.jboss.cache.pojo.notification.event.AttachedEvent;
+//import org.jboss.cache.pojo.notification.event.DetachedEvent;
+//import org.jboss.cache.pojo.notification.event.Event;
+//import org.jboss.cache.pojo.notification.NotificationContext;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.pojo.impl.InternalHelper;
+//import org.jboss.cache.Fqn;
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//
+//import javax.transaction.Transaction;
+//
+///**
+// * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+// */
+//
+//@PojoCacheListener
+//@CacheListener
+//public class SearchablePojoListener
+//{
+// private SearchFactoryImplementor searchFactory;
+// private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
+// private String pojoKey = "pojoKey";
+//
+// private ThreadLocal<Fqn> savedFqn = new ThreadLocal<Fqn>();
+//
+// public SearchablePojoListener(SearchFactoryImplementor searchFactory)
+// {
+// this.searchFactory = searchFactory;
+// }
+//
+// @NodeModified
+// public void handleNodeModified(NodeModifiedEvent nme)
+// {
+// if (!nme.isPre()) return;
+// Fqn f = nme.getFqn();
+// if(log.isDebugEnabled()) log.debug("Node modified called for Fqn " + f);
+// if (InternalHelper.isInternalNode(f))
+// {
+// if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+// }
+// else
+// {
+// savedFqn.set(f);
+// if(log.isDebugEnabled()) log.debug("Saved Fqn to ThreadLocal.");
+// }
+// }
+//
+// @NodeCreated
+// public void handleNodeKreated(NodeCreatedEvent nce)
+// {
+// if (!nce.isPre()) return;
+// Fqn f = nce.getFqn();
+// if(log.isDebugEnabled()) log.debug("Node kreated called for Fqn " + f);
+// if (InternalHelper.isInternalNode(f))
+// {
+// if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+// }
+// else
+// {
+// savedFqn.set(f);
+// if(log.isDebugEnabled()) log.debug("savedFqn.set() called");
+// }
+// }
+//
+// /**
+// * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
+// *
+// * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
+// * @throws InvalidKeyException if an invalid key is given.
+// */
+//
+// @Attached
+// public void handleAttach(AttachedEvent event) throws InvalidKeyException
+// {
+// System.out.println("Pojocache.attach() called");
+// Object added = event.getSource();
+//
+// System.out.println("the object is " + event.toString());
+//
+// NotificationContext notificationContext = event.getContext();
+// System.out.println("notificationContext is " + notificationContext);
+//
+// PojoCache pojo = notificationContext.getPojoCache();
+// System.out.println("pojo is " + pojo);
+//
+//// Fqn fqn = pojo.getInternalFqn(added);
+// Fqn fqn = savedFqn.get();
+// savedFqn.remove();
+// System.out.println("Fqn is " + fqn);
+//
+//
+// CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+// System.out.println("new CEI created" + cacheEntityId);
+//
+// TransactionContext ctx = new PojoTransactionContext(event);
+// System.out.println("new ctx created" + ctx);
+//
+// searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
+// }
+//
+// @Detached
+// public void handleDetach(DetachedEvent event) throws InvalidKeyException
+// {
+// Object deleted = event.getSource();
+// Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
+//
+// CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+//
+// TransactionContext ctx = new PojoTransactionContext(event);
+//
+// searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
+// }
+//
+// //TODO: Sort out updating Lucene for the following annotations: -
+//// @FieldModified
+//// @ListModified
+//// @ArrayModified
+//// @SetModified
+//
+//}
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2009-01-04 16:13:23 UTC (rev 7349)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2009-01-04 16:28:01 UTC (rev 7350)
@@ -31,7 +31,7 @@
* @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
*/
-@Test(groups = "functional", enabled = true)
+@Test(groups = "functional", enabled = false)
public class LocalPOJOCacheTest
{
SearchableCache searchableCache;
16 years
JBoss Cache SVN: r7349 - in searchable/trunk: src/main/java/org/jboss/cache and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2009-01-04 11:13:23 -0500 (Sun, 04 Jan 2009)
New Revision: 7349
Added:
searchable/trunk/src/main/java/org/jboss/cache/search/Version.java
Removed:
searchable/trunk/src/main/java/org/jboss/cache/Version.java
Modified:
searchable/trunk/pom.xml
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/BrokenAnnotationTest.java
Log:
Updated code to work with Hibernate Search 3.1 GA and JBC 3.0.0.GA - tests pass
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/pom.xml 2009-01-04 16:13:23 UTC (rev 7349)
@@ -31,7 +31,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
- <version>3.1.0.Beta1</version>
+ <version>3.1.0.GA</version>
</dependency>
<dependency>
@@ -96,7 +96,7 @@
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- <mainClass>org.jboss.cache.Version</mainClass>
+ <mainClass>org.jboss.cache.search.Version</mainClass>
</manifest>
</archive>
</configuration>
Deleted: searchable/trunk/src/main/java/org/jboss/cache/Version.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/Version.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/main/java/org/jboss/cache/Version.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -1,16 +0,0 @@
-package org.jboss.cache;
-
-/**
- * Spits out the version number.
- *
- * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
- */
-public class Version
-{
- //version string - should correspond with the version in the pom
- private static final String version = "1.0.0-SNAPSHOT";
- public static void main(String[] args)
- {
- System.out.println("\nJBoss Cache Searchable Edition\nVersion:\t" + version + "\n\n");
- }
-}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -25,17 +25,21 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.index.Term;
+import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.*;
import org.hibernate.HibernateException;
import org.hibernate.search.FullTextFilter;
import org.hibernate.search.SearchException;
-import org.hibernate.search.engine.DocumentBuilder;
-import org.hibernate.search.engine.DocumentExtractor;
-import org.hibernate.search.engine.FilterDef;
-import org.hibernate.search.engine.SearchFactoryImplementor;
+import org.hibernate.search.reader.ReaderProvider;
+import static org.hibernate.search.reader.ReaderProviderHelper.getIndexReaders;
+import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheInstance;
+import static org.hibernate.search.util.FilterCacheModeTypeHelper.cacheResults;
+import org.hibernate.search.engine.*;
import org.hibernate.search.filter.ChainedFilter;
import org.hibernate.search.filter.FilterKey;
+import org.hibernate.search.filter.StandardFilterKey;
import org.hibernate.search.query.FullTextFilterImpl;
+import org.hibernate.search.query.QueryHits;
import org.hibernate.search.store.DirectoryProvider;
import org.hibernate.transform.ResultTransformer;
import org.jboss.cache.Cache;
@@ -68,26 +72,24 @@
private Integer resultSize;
private Integer maxResults;
private static final Log log = LogFactory.getLog(CacheQueryImpl.class);
- private Set<Class> classesAndSubclasses;
private boolean needClassFilterClause;
private Query luceneQuery;
private String[] indexProjection;
private ResultTransformer resultTransformer;
CacheEntityLoader entityLoader;
+ private Set<Class<?>> targetedEntities;
+ private Set<Class<?>> classesAndSubclasses;
+ private Set<String> idFieldNames;
+ private boolean allowFieldSelectionInProjection = true;
- public CacheQueryImpl(Query luceneQuery, SearchFactoryImplementor searchFactory, Cache cache)
+ public CacheQueryImpl(Query luceneQuery, SearchFactoryImplementor searchFactory, Cache cache, Class... classes)
{
-
this.luceneQuery = luceneQuery;
// this.cache = cache;
entityLoader = new CacheEntityLoader(cache);
this.searchFactory = searchFactory;
- }
-
- public CacheQueryImpl(Query luceneQuery, SearchFactoryImplementor searchFactory, Cache cache, Class... classes)
- {
- this(luceneQuery, searchFactory, cache);
+ this.targetedEntities = this.searchFactory.getIndexedTypesPolymorphic( classes );
this.classes = classes;
}
@@ -110,7 +112,7 @@
{
if (resultSize == null)
{
-// get result size without object initialization
+ //get result size without object initialization
IndexSearcher searcher = buildSearcher(searchFactory);
if (searcher == null)
{
@@ -118,11 +120,11 @@
}
else
{
- Hits hits;
+ TopDocs hits;
try
{
- hits = getHits(searcher);
- resultSize = hits.length();
+ hits = getQueryHits(searcher, 1).topDocs; // Lucene enforces that at least one top doc will be retrieved.
+ resultSize = hits.totalHits;
}
catch (IOException e)
{
@@ -133,7 +135,7 @@
//searcher cannot be null
try
{
- IndexSearcherCloser.closeSearcher(searcher, searchFactory.getReaderProvider());
+ closeSearcher(searcher, searchFactory.getReaderProvider());
//searchFactoryImplementor.getReaderProvider().closeReader( searcher.getIndexReader() );
}
catch (SearchException e)
@@ -146,6 +148,17 @@
return this.resultSize;
}
+ private void closeSearcher(Searcher searcher, ReaderProvider readerProvider)
+ {
+ Set<IndexReader> indexReaders = getIndexReaders(searcher);
+
+ for (IndexReader indexReader : indexReaders)
+ {
+ readerProvider.closeReader(indexReader);
+ }
+ }
+
+
public void setSort(Sort s)
{
sort = s;
@@ -202,12 +215,11 @@
}
this.firstResult = firstResult;
- //TODO How do we deal with this if the parameter is too high.
}
public QueryResultIterator iterator() throws HibernateException
{
- return iterator (1);
+ return iterator(1);
}
public QueryResultIterator iterator(int fetchSize) throws HibernateException
@@ -221,16 +233,16 @@
try
{
- Hits hits = getHits(searcher);
+ QueryHits queryHits = getQueryHits(searcher, calculateTopDocsRetrievalSize());
int first = first();
- int max = max(first, hits);
+ int max = max(first, queryHits.totalHits);
int size = max - first + 1 < 0 ? 0 : max - first + 1;
ids = new ArrayList<CacheEntityId>(size);
- DocumentExtractor extractor = new DocumentExtractor(luceneQuery, searcher, searchFactory, indexProjection);
+ DocumentExtractor extractor = new DocumentExtractor(queryHits, searchFactory, indexProjection, idFieldNames, allowFieldSelectionInProjection);
for (int index = first; index <= max; index++)
{
- String documentId = (String) extractor.extract(hits, index).id;
+ String documentId = (String) extractor.extract(index).id;
CacheEntityId id = new CacheEntityId(documentId);
ids.add(id);
}
@@ -263,13 +275,13 @@
try
{
- Hits hits = getHits(searcher);
+ QueryHits queryHits = getQueryHits(searcher, calculateTopDocsRetrievalSize());
int first = first();
- int max = max(first, hits);
+ int max = max(first, queryHits.totalHits);
- DocumentExtractor extractor = new DocumentExtractor(luceneQuery, searcher, searchFactory, indexProjection);
+ DocumentExtractor extractor = new DocumentExtractor(queryHits, searchFactory, indexProjection, idFieldNames, allowFieldSelectionInProjection);
- return new LazyQueryResultIterator(extractor, entityLoader, hits, searcher, searchFactory, first, max, fetchSize);
+ return new LazyQueryResultIterator(extractor, entityLoader, searcher, searchFactory, first, max, fetchSize);
}
catch (IOException e)
{
@@ -291,25 +303,24 @@
{
IndexSearcher searcher = buildSearcher(searchFactory);
- if (searcher == null) return new ArrayList(0);
+ if (searcher == null) return Collections.EMPTY_LIST;
- Hits hits;
try
{
- hits = getHits(searcher);
- if (log.isTraceEnabled()) log.trace("Number of hits are " + hits.length());
+ QueryHits queryHits = getQueryHits(searcher, calculateTopDocsRetrievalSize());
+ if (log.isTraceEnabled()) log.trace("Number of hits are " + queryHits.totalHits);
int first = first();
- int max = max(first, hits);
+ int max = max(first, queryHits.totalHits);
int size = max - first + 1 < 0 ? 0 : max - first + 1;
List<CacheEntityId> ids = new ArrayList<CacheEntityId>(size);
- DocumentExtractor extractor = new DocumentExtractor(luceneQuery, searcher, searchFactory, indexProjection);
+ DocumentExtractor extractor = new DocumentExtractor(queryHits, searchFactory, indexProjection, idFieldNames, allowFieldSelectionInProjection);
for (int index = first; index <= max; index++)
{
- String documentId = (String) extractor.extract(hits, index).id;
+ String documentId = (String) extractor.extract(index).id;
CacheEntityId id = new CacheEntityId(documentId);
ids.add(id);
}
@@ -340,13 +351,18 @@
}
- private int max(int first, Hits hits)
+ private int max(int first, int totalHits)
{
- return maxResults == null ?
- hits.length() - 1 :
- maxResults + first < hits.length() ?
- first + maxResults - 1 :
- hits.length() - 1;
+ if (maxResults == null)
+ {
+ return totalHits - 1;
+ }
+ else
+ {
+ return maxResults + first < totalHits ?
+ first + maxResults - 1 :
+ totalHits - 1;
+ }
}
private int first()
@@ -356,6 +372,36 @@
0;
}
+ private QueryHits getQueryHits(Searcher searcher, Integer n) throws IOException
+ {
+ org.apache.lucene.search.Query query = filterQueryByClasses(luceneQuery);
+ buildFilters();
+ QueryHits queryHits;
+ if (n == null)
+ { // try to make sure that we get the right amount of top docs
+ queryHits = new QueryHits(searcher, query, filter, sort);
+ }
+ else
+ {
+ queryHits = new QueryHits(searcher, query, filter, sort, n);
+ }
+ resultSize = queryHits.totalHits;
+ return queryHits;
+ }
+
+ private Integer calculateTopDocsRetrievalSize()
+ {
+ if (maxResults == null)
+ {
+ return null;
+ }
+ else
+ {
+ return first() + maxResults;
+ }
+ }
+
+
public void setMaxResults(int maxResults)
{
if (maxResults < 0)
@@ -367,46 +413,68 @@
private IndexSearcher buildSearcher(SearchFactoryImplementor searchFactoryImplementor)
{
- Map<Class, DocumentBuilder<Object>> builders = searchFactoryImplementor.getDocumentBuilders();
+ Map<Class<?>, DocumentBuilderIndexedEntity<?>> builders = searchFactoryImplementor.getDocumentBuildersIndexedEntities();
List<DirectoryProvider> directories = new ArrayList<DirectoryProvider>();
-
+ Set<String> idFieldNames = new HashSet<String>();
Similarity searcherSimilarity = null;
-
- if (classes == null || classes.length == 0)
+ if (targetedEntities.size() == 0)
{
- //no class means all classes
- for (DocumentBuilder builder : builders.values())
+ // empty targetedEntities array means search over all indexed enities,
+ // but we have to make sure there is at least one
+ if (builders.isEmpty())
{
+ throw new HibernateException(
+ "There are no mapped entities. Don't forget to add @Indexed to at least one class."
+ );
+ }
+
+ for (DocumentBuilderIndexedEntity builder : builders.values())
+ {
searcherSimilarity = checkSimilarity(searcherSimilarity, builder);
- final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
+ if (builder.getIdKeywordName() != null)
+ {
+ idFieldNames.add(builder.getIdKeywordName());
+ allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
+ }
+ final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy()
+ .getDirectoryProvidersForAllShards();
populateDirectories(directories, directoryProviders);
}
classesAndSubclasses = null;
}
else
{
- Set<Class> involvedClasses = new HashSet<Class>(classes.length);
- Collections.addAll(involvedClasses, classes);
- for (Class clazz : classes)
+ Set<Class<?>> involvedClasses = new HashSet<Class<?>>(targetedEntities.size());
+ involvedClasses.addAll(targetedEntities);
+ for (Class<?> clazz : targetedEntities)
{
- DocumentBuilder builder = builders.get(clazz);
- if (builder != null) involvedClasses.addAll(builder.getMappedSubclasses());
+ DocumentBuilderIndexedEntity<?> builder = builders.get(clazz);
+ if (builder != null)
+ {
+ involvedClasses.addAll(builder.getMappedSubclasses());
+ }
}
for (Class clazz : involvedClasses)
{
- DocumentBuilder builder = builders.get(clazz);
+ DocumentBuilderIndexedEntity builder = builders.get(clazz);
if (builder == null)
{
throw new HibernateException("Not a mapped entity (don't forget to add @Indexed): " + clazz);
}
-
- final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy().getDirectoryProvidersForAllShards();
+ if (builder.getIdKeywordName() != null)
+ {
+ idFieldNames.add(builder.getIdKeywordName());
+ allowFieldSelectionInProjection = allowFieldSelectionInProjection && builder.allowFieldSelectionInProjection();
+ }
+ final DirectoryProvider[] directoryProviders = builder.getDirectoryProviderSelectionStrategy()
+ .getDirectoryProvidersForAllShards();
searcherSimilarity = checkSimilarity(searcherSimilarity, builder);
populateDirectories(directories, directoryProviders);
}
- classesAndSubclasses = involvedClasses;
+ this.classesAndSubclasses = involvedClasses;
}
+ this.idFieldNames = idFieldNames;
//compute optimization needClassFilterClause
//if at least one DP contains one class that is not part of the targeted classesAndSubclasses we can't optimize
@@ -414,7 +482,9 @@
{
for (DirectoryProvider dp : directories)
{
- final Set<Class> classesInDirectoryProvider = searchFactoryImplementor.getClassesInDirectoryProvider(dp);
+ final Set<Class<?>> classesInDirectoryProvider = searchFactoryImplementor.getClassesInDirectoryProvider(
+ dp
+ );
// if a DP contains only one class, we know for sure it's part of classesAndSubclasses
if (classesInDirectoryProvider.size() > 1)
{
@@ -428,18 +498,26 @@
}
}
}
- if (this.needClassFilterClause) break;
+ if (this.needClassFilterClause)
+ {
+ break;
+ }
}
}
//set up the searcher
final DirectoryProvider[] directoryProviders = directories.toArray(new DirectoryProvider[directories.size()]);
- IndexSearcher is = new IndexSearcher(searchFactoryImplementor.getReaderProvider().openReader(directoryProviders));
+ IndexSearcher is = new IndexSearcher(
+ searchFactoryImplementor.getReaderProvider().openReader(
+ directoryProviders
+ )
+ );
is.setSimilarity(searcherSimilarity);
return is;
}
- private Similarity checkSimilarity(Similarity similarity, DocumentBuilder builder)
+
+ private Similarity checkSimilarity(Similarity similarity, DocumentBuilderIndexedEntity builder)
{
if (similarity == null)
{
@@ -465,20 +543,7 @@
}
}
- private Hits getHits(Searcher searcher) throws IOException
- {
- Hits hits;
- org.apache.lucene.search.Query query = filterQueryByClasses(luceneQuery);
- buildFilters();
- hits = searcher.search(query, filter, sort);
- setResultSize(hits);
- return hits;
- }
- private void setResultSize(Hits hits)
- {
- resultSize = hits.length();
- }
private org.apache.lucene.search.Query filterQueryByClasses(org.apache.lucene.search.Query luceneQuery)
{
@@ -506,125 +571,216 @@
}
}
+
+ // Method changed by Navin Surtani on Dec 16th 2008. Copied out from FullTextQueryImpl from Hibernate Search code like
+ // previously done. Also copied in methods like buildLuceneFilter(), createFilter() and those methods that follow down
+ // until the end of the class.
private void buildFilters()
{
- if (filterDefinitions != null && filterDefinitions.size() > 0)
+ if (filterDefinitions == null || filterDefinitions.size() == 0)
{
- ChainedFilter chainedFilter = new ChainedFilter();
- for (FullTextFilterImpl filterDefinition : filterDefinitions.values())
+ return; // there is nothing to do if we don't have any filter definitions
+ }
+
+ ChainedFilter chainedFilter = new ChainedFilter();
+ for (FullTextFilterImpl fullTextFilter : filterDefinitions.values())
+ {
+ Filter filter = buildLuceneFilter(fullTextFilter);
+ chainedFilter.addFilter(filter);
+ }
+
+ if (filter != null)
+ {
+ chainedFilter.addFilter(filter);
+ }
+ filter = chainedFilter;
+ }
+
+ private Filter buildLuceneFilter(FullTextFilterImpl fullTextFilter)
+ {
+
+ /*
+ * FilterKey implementations and Filter(Factory) do not have to be threadsafe wrt their parameter injection
+ * as FilterCachingStrategy ensure a memory barrier between concurrent thread calls
+ */
+ FilterDef def = searchFactory.getFilterDefinition(fullTextFilter.getName());
+ Object instance = createFilterInstance(fullTextFilter, def);
+ FilterKey key = createFilterKey(def, instance);
+
+ // try to get the filter out of the cache
+ Filter filter = cacheInstance(def.getCacheMode()) ?
+ searchFactory.getFilterCachingStrategy().getCachedFilter(key) :
+ null;
+
+ if (filter == null)
+ {
+ filter = createFilter(def, instance);
+
+ // add filter to cache if we have to
+ if (cacheInstance(def.getCacheMode()))
{
- FilterDef def = searchFactory.getFilterDefinition(filterDefinition.getName());
- Class implClass = def.getImpl();
- Object instance;
- try
+ searchFactory.getFilterCachingStrategy().addCachedFilter(key, filter);
+ }
+ }
+ return filter;
+ }
+
+ private Filter createFilter(FilterDef def, Object instance)
+ {
+ Filter filter;
+ if (def.getFactoryMethod() != null)
+ {
+ try
+ {
+ filter = (Filter) def.getFactoryMethod().invoke(instance);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new SearchException(
+ "Unable to access @Factory method: "
+ + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
+ );
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new SearchException(
+ "Unable to access @Factory method: "
+ + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
+ );
+ }
+ catch (ClassCastException e)
+ {
+ throw new SearchException(
+ "@Key method does not return a org.apache.lucene.search.Filter class: "
+ + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
+ );
+ }
+ }
+ else
+ {
+ try
+ {
+ filter = (Filter) instance;
+ }
+ catch (ClassCastException e)
+ {
+ throw new SearchException(
+ "Filter implementation does not implement the Filter interface: "
+ + def.getImpl().getName() + ". "
+ + (def.getFactoryMethod() != null ? def.getFactoryMethod().getName() : ""), e
+ );
+ }
+ }
+
+ filter = addCachingWrapperFilter(filter, def);
+ return filter;
+ }
+
+ private Object createFilterInstance(FullTextFilterImpl fullTextFilter,
+ FilterDef def)
+ {
+ Object instance;
+ try
+ {
+ instance = def.getImpl().newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new SearchException("Unable to create @FullTextFilterDef: " + def.getImpl(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new SearchException("Unable to create @FullTextFilterDef: " + def.getImpl(), e);
+ }
+ for (Map.Entry<String, Object> entry : fullTextFilter.getParameters().entrySet())
+ {
+ def.invoke(entry.getKey(), instance, entry.getValue());
+ }
+ if (cacheInstance(def.getCacheMode()) && def.getKeyMethod() == null && fullTextFilter.getParameters()
+ .size() > 0)
+ {
+ throw new SearchException("Filter with parameters and no @Key method: " + fullTextFilter.getName());
+ }
+ return instance;
+ }
+
+
+ private FilterKey createFilterKey(FilterDef def, Object instance)
+ {
+ FilterKey key = null;
+ if (!cacheInstance(def.getCacheMode()))
+ {
+ return key; // if the filter is not cached there is no key!
+ }
+
+ if (def.getKeyMethod() == null)
+ {
+ key = new FilterKey()
+ {
+ public int hashCode()
{
- instance = implClass.newInstance();
+ return getImpl().hashCode();
}
- catch (Exception e)
- {
- throw new SearchException("Unable to create @FullTextFilterDef: " + def.getImpl(), e);
- }
- for (Map.Entry<String, Object> entry : filterDefinition.getParameters().entrySet())
- {
- def.invoke(entry.getKey(), instance, entry.getValue());
- }
- if (def.isCache() && def.getKeyMethod() == null && filterDefinition.getParameters().size() > 0)
- {
- throw new SearchException("Filter with parameters and no @Key method: " + filterDefinition.getName());
- }
- FilterKey key = null;
- if (def.isCache())
- {
- if (def.getKeyMethod() == null)
- {
- key = new FilterKey()
- {
- public int hashCode()
- {
- return getImpl().hashCode();
- }
- public boolean equals(Object obj)
- {
- if (!(obj instanceof FilterKey)) return false;
- FilterKey that = (FilterKey) obj;
- return this.getImpl().equals(that.getImpl());
- }
- };
- }
- else
- {
- try
- {
- key = (FilterKey) def.getKeyMethod().invoke(instance);
- }
- catch (IllegalAccessException e)
- {
- throw new SearchException("Unable to access @Key method: "
- + def.getImpl().getName() + "." + def.getKeyMethod().getName());
- }
- catch (InvocationTargetException e)
- {
- throw new SearchException("Unable to access @Key method: "
- + def.getImpl().getName() + "." + def.getKeyMethod().getName());
- }
- catch (ClassCastException e)
- {
- throw new SearchException("@Key method does not return FilterKey: "
- + def.getImpl().getName() + "." + def.getKeyMethod().getName());
- }
- }
- key.setImpl(def.getImpl());
- }
-
- Filter filter = def.isCache() ?
- searchFactory.getFilterCachingStrategy().getCachedFilter(key) :
- null;
- if (filter == null)
+ public boolean equals(Object obj)
{
- if (def.getFactoryMethod() != null)
+ if (!(obj instanceof FilterKey))
{
- try
- {
- filter = (Filter) def.getFactoryMethod().invoke(instance);
- }
- catch (IllegalAccessException e)
- {
- throw new SearchException("Unable to access @Factory method: "
- + def.getImpl().getName() + "." + def.getFactoryMethod().getName());
- }
- catch (InvocationTargetException e)
- {
- throw new SearchException("Unable to access @Factory method: "
- + def.getImpl().getName() + "." + def.getFactoryMethod().getName());
- }
- catch (ClassCastException e)
- {
- throw new SearchException("@Key method does not return a org.apache.lucene.search.Filter class: "
- + def.getImpl().getName() + "." + def.getFactoryMethod().getName());
- }
+ return false;
}
- else
- {
- try
- {
- filter = (Filter) instance;
- }
- catch (ClassCastException e)
- {
- throw new SearchException("@Key method does not return a org.apache.lucene.search.Filter class: "
- + def.getImpl().getName() + "." + def.getFactoryMethod().getName());
- }
- }
- if (def.isCache())
- {
- searchFactory.getFilterCachingStrategy().addCachedFilter(key, filter);
- }
+ FilterKey that = (FilterKey) obj;
+ return this.getImpl().equals(that.getImpl());
}
- chainedFilter.addFilter(filter);
+ };
+ }
+ else
+ {
+ try
+ {
+ key = (FilterKey) def.getKeyMethod().invoke(instance);
}
- if (filter != null) chainedFilter.addFilter(filter);
- filter = chainedFilter;
+ catch (IllegalAccessException e)
+ {
+ throw new SearchException(
+ "Unable to access @Key method: "
+ + def.getImpl().getName() + "." + def.getKeyMethod().getName()
+ );
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new SearchException(
+ "Unable to access @Key method: "
+ + def.getImpl().getName() + "." + def.getKeyMethod().getName()
+ );
+ }
+ catch (ClassCastException e)
+ {
+ throw new SearchException(
+ "@Key method does not return FilterKey: "
+ + def.getImpl().getName() + "." + def.getKeyMethod().getName()
+ );
+ }
}
+ key.setImpl(def.getImpl());
+
+ //Make sure Filters are isolated by filter def name
+ StandardFilterKey wrapperKey = new StandardFilterKey();
+ wrapperKey.addParameter(def.getName());
+ wrapperKey.addParameter(key);
+ return wrapperKey;
}
+
+ private Filter addCachingWrapperFilter(Filter filter, FilterDef def)
+ {
+ if (cacheResults(def.getCacheMode()))
+ {
+ int cachingWrapperFilterSize = searchFactory.getFilterCacheBitResultsSize();
+ filter = new org.hibernate.search.filter.CachingWrapperFilter(filter, cachingWrapperFilterSize);
+ }
+
+ return filter;
+ }
+
+
}
+
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -24,7 +24,6 @@
import org.hibernate.search.engine.DocumentExtractor;
import org.hibernate.search.engine.SearchFactoryImplementor;
-import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import java.util.NoSuchElementException;
@@ -47,12 +46,11 @@
private int fetchSize = 0; // difference between fetchsize and index must always be the value for first. fetchSize has to be at least 1.
private CacheEntityLoader entityLoader;
private DocumentExtractor extractor;
- private Hits hits;
private IndexSearcher searcher;
private SearchFactoryImplementor searchFactory;
Object[] buffer;
- public LazyQueryResultIterator(DocumentExtractor extractor, CacheEntityLoader entityLoader, Hits hits,
+ public LazyQueryResultIterator(DocumentExtractor extractor, CacheEntityLoader entityLoader,
IndexSearcher searcher, SearchFactoryImplementor searchFactory, int first, int max, int fetchSize)
{
if (fetchSize < 1)
@@ -66,7 +64,6 @@
this.first = first;
this.max = max;
this.fetchSize = fetchSize;
- this.hits = hits;
this.searcher = searcher;
this.searchFactory = searchFactory;
@@ -157,7 +154,7 @@
try
{
- String documentId = (String) extractor.extract(hits, index).id;
+ String documentId = (String) extractor.extract(index).id;
CacheEntityId id = new CacheEntityId(documentId);
toReturn = entityLoader.load(id);
@@ -171,7 +168,7 @@
for (int i = 1; i < bufferSize; i++)
{
- String bufferDocumentId = (String) extractor.extract(hits, index + i).id;
+ String bufferDocumentId = (String) extractor.extract(index + i).id;
CacheEntityId bufferId = new CacheEntityId(bufferDocumentId);
Object toBuffer = entityLoader.load(bufferId);
buffer[i] = toBuffer;
@@ -216,7 +213,7 @@
//Wiping the buffer
Arrays.fill(buffer, null);
- String documentId = (String) extractor.extract(hits, index).id;
+ String documentId = (String) extractor.extract(index).id;
CacheEntityId id = new CacheEntityId(documentId);
toReturn = entityLoader.load(id);
@@ -225,7 +222,7 @@
//now loop through bufferSize times to add the rest of the objects into the list.
for (int i = 1; i < bufferSize; i++)
{
- String bufferDocumentId = (String) extractor.extract(hits, index - i).id; //In this case it has to be index - i because previous() is called.
+ String bufferDocumentId = (String) extractor.extract(index - i).id; //In this case it has to be index - i because previous() is called.
CacheEntityId bufferId = new CacheEntityId(bufferDocumentId);
Object toBuffer = entityLoader.load(bufferId);
buffer[i] = toBuffer;
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -37,13 +37,6 @@
public interface SearchableCache<K, V> extends Cache<K, V>
{
- /**
- * Creates a CacheQuery object from a luceneQuery.
- *
- * @param luceneQuery - from {@link org.apache.lucene.search.Query}
- * @return a CacheQuery instance from which the user can get a list/iterator object.
- */
- CacheQuery createQuery(Query luceneQuery);
/**
* Creates a CacheQuery from a lucene query and a class array.
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -63,22 +63,10 @@
}
/**
- * Creates a CacheQuery object from a given Lucene Query.
- *
- * @param luceneQuery - for lucene
- * @return CacheQuery object
- */
-
- public CacheQuery createQuery(Query luceneQuery)
- {
- return new CacheQueryImpl(luceneQuery, searchFactory, cache);
- }
-
- /**
* Creates a CacheQuery object from a Lucene Query and a class array.
*
* @param luceneQuery - for lucene
- * @param classes array
+ * @param classes array
* @return CacheQuery object.
*/
Copied: searchable/trunk/src/main/java/org/jboss/cache/search/Version.java (from rev 7323, searchable/trunk/src/main/java/org/jboss/cache/Version.java)
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/Version.java (rev 0)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/Version.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -0,0 +1,16 @@
+package org.jboss.cache.search;
+
+/**
+ * Spits out the version number.
+ *
+ * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+ */
+public class Version
+{
+ //version string - should correspond with the version in the pom
+ private static final String version = "1.0.0-SNAPSHOT";
+ public static void main(String[] args)
+ {
+ System.out.println("\nJBoss Cache Searchable Edition\nVersion:\t" + version + "\n\n");
+ }
+}
Modified: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/BrokenAnnotationTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/BrokenAnnotationTest.java 2009-01-04 09:35:48 UTC (rev 7348)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/BrokenAnnotationTest.java 2009-01-04 16:13:23 UTC (rev 7349)
@@ -9,6 +9,8 @@
import org.jboss.cache.DefaultCacheFactory;
/**
+ * This test is to try and create a searchable cache without the proper annotations used.
+ *
* @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
*/
@Test (groups = "functional")
16 years