Package org.infinispan.query.impl
Class SearchManagerImpl
- java.lang.Object
-
- org.infinispan.query.impl.SearchManagerImpl
-
- All Implemented Interfaces:
SearchManager,SearchManagerImplementor
public final class SearchManagerImpl extends Object implements SearchManagerImplementor
Class that is used to build aCacheQuerybased on a Lucene or an Ickle query, only for indexed caches.- Since:
- 4.0
- Author:
- Navin Surtani, Sanne Grinovero <sanne@hibernate.org> (C) 2011 Red Hat Inc., Marko Luksa
-
-
Constructor Summary
Constructors Constructor Description SearchManagerImpl(org.infinispan.AdvancedCache<?,?> cache, QueryEngine<?> queryEngine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.analysis.AnalyzergetAnalyzer(Class<?> clazz)Retrieves the scoped analyzer for a given class type.org.apache.lucene.analysis.AnalyzergetAnalyzer(String name)Retrieve an analyzer instance by its definition nameMassIndexergetMassIndexer()The MassIndexer can be used to rebuild the Lucene indexes from the entries stored in Infinispan.<E> CacheQuery<E>getQuery(String queryString)Builds aCacheQueryfrom an Ickle query string, assuming the correct value forIndexedQueryModeto query all data in the cluster<E> CacheQuery<E>getQuery(String queryString, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode)Builds aCacheQueryfrom an Ickle query string.<E> CacheQuery<E>getQuery(org.apache.lucene.search.Query luceneQuery, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode, Class<?> entity)This is a simple method that will just return aCacheQuery, filtered according to a set of classes passed in.<E> CacheQuery<E>getQuery(QueryDefinition queryDefinition, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> indexedTypeMap)Creates a cache query based on aQueryDefinitionand a custom metadata.org.hibernate.search.stat.StatisticsgetStatistics()Get access to the Query specific statistics for this SearchManager instancevoidpurge(Class<?> entityType)Remove all entities of particular class from the index.voidsetTimeoutExceptionFactory(org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory)Define the timeout exception factory to customize the exception thrown when the query timeout is exceeded.<T> Tunwrap(Class<T> cls)This method gives access to internal Infinispan implementation details, and should not be normally needed.
-
-
-
Constructor Detail
-
SearchManagerImpl
public SearchManagerImpl(org.infinispan.AdvancedCache<?,?> cache, QueryEngine<?> queryEngine)
-
-
Method Detail
-
getQuery
public <E> CacheQuery<E> getQuery(org.apache.lucene.search.Query luceneQuery, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode, Class<?> entity)
Description copied from interface:SearchManagerImplementorThis is a simple method that will just return aCacheQuery, filtered according to a set of classes passed in. If no classes are passed in, it is assumed that no type filtering is performed and so all known types will be searched.- Specified by:
getQueryin interfaceSearchManagerImplementor- Parameters:
luceneQuery-QueryindexedQueryMode- TheIndexedQueryModeused when executing the query.entity- The entity type to query against.- Returns:
- the CacheQuery object which can be used to iterate through results.
-
getQuery
public <E> CacheQuery<E> getQuery(String queryString, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode)
Description copied from interface:SearchManagerBuilds aCacheQueryfrom an Ickle query string.- Specified by:
getQueryin interfaceSearchManager
-
getQuery
public <E> CacheQuery<E> getQuery(String queryString)
Description copied from interface:SearchManagerBuilds aCacheQueryfrom an Ickle query string, assuming the correct value forIndexedQueryModeto query all data in the cluster- Specified by:
getQueryin interfaceSearchManager- Parameters:
queryString- the Ickle query- Returns:
-
getQuery
public <E> CacheQuery<E> getQuery(QueryDefinition queryDefinition, org.infinispan.query.dsl.IndexedQueryMode indexedQueryMode, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> indexedTypeMap)
Description copied from interface:SearchManagerImplementorCreates a cache query based on aQueryDefinitionand a custom metadata.- Specified by:
getQueryin interfaceSearchManagerImplementor
-
setTimeoutExceptionFactory
public void setTimeoutExceptionFactory(org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory)
Description copied from interface:SearchManagerImplementorDefine the timeout exception factory to customize the exception thrown when the query timeout is exceeded.- Specified by:
setTimeoutExceptionFactoryin interfaceSearchManagerImplementor- Parameters:
timeoutExceptionFactory- the timeout exception factory to use
-
getMassIndexer
public MassIndexer getMassIndexer()
Description copied from interface:SearchManagerThe MassIndexer can be used to rebuild the Lucene indexes from the entries stored in Infinispan.- Specified by:
getMassIndexerin interfaceSearchManager- Returns:
- the MassIndexer component
-
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
Description copied from interface:SearchManagerRetrieve an analyzer instance by its definition name- Specified by:
getAnalyzerin interfaceSearchManager- Parameters:
name- the name of the analyzer- Returns:
- analyzer with the specified name
-
getStatistics
public org.hibernate.search.stat.Statistics getStatistics()
Description copied from interface:SearchManagerGet access to the Query specific statistics for this SearchManager instance- Specified by:
getStatisticsin interfaceSearchManager- Returns:
- The statistics.
-
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer(Class<?> clazz)
Description copied from interface:SearchManagerRetrieves the scoped analyzer for a given class type.- Specified by:
getAnalyzerin interfaceSearchManager- Parameters:
clazz- The class for which to retrieve the analyzer.- Returns:
- The scoped analyzer for the specified class.
-
purge
public void purge(Class<?> entityType)
Description copied from interface:SearchManagerRemove all entities of particular class from the index.- Specified by:
purgein interfaceSearchManager- Parameters:
entityType- The class of the entity to remove.
-
unwrap
public <T> T unwrap(Class<T> cls)
Description copied from interface:SearchManagerThis method gives access to internal Infinispan implementation details, and should not be normally needed. The interface of the internal types does not constitute a public API and can (and probably will) change without notice.- Specified by:
unwrapin interfaceSearchManager- Parameters:
cls- the class of the desired internal component- Returns:
- the 'unwrapped' internal component
-
-