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 aCacheQuery
based 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(AdvancedCache<?,?> cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.hibernate.search.query.dsl.EntityContext
buildQueryBuilderForClass(Class<?> entityType)
Provides the Hibernate Search DSL entrypoint to build full text queries.org.apache.lucene.analysis.Analyzer
getAnalyzer(Class<?> clazz)
Retrieves the scoped analyzer for a given class type.org.apache.lucene.analysis.Analyzer
getAnalyzer(String name)
Retrieve an analyzer instance by its definition name<E> CacheQuery<E>
getClusteredQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... classes)
Deprecated.MassIndexer
getMassIndexer()
The MassIndexer can be used to rebuild the Lucene indexes from the entries stored in Infinispan.<E> CacheQuery<E>
getQuery(String queryString, IndexedQueryMode indexedQueryMode, Class<?>... classes)
Builds aCacheQuery
from an Ickle query string.<E> CacheQuery<E>
getQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... classes)
<E> CacheQuery<E>
getQuery(org.apache.lucene.search.Query luceneQuery, IndexedQueryMode indexedQueryMode, Class<?>... classes)
This is a simple method that will just return aCacheQuery
, filtered according to a set of classes passed in.<E> CacheQuery<E>
getQuery(org.hibernate.search.query.engine.spi.HSQuery hSearchQuery, IndexedQueryMode queryMode)
Internal and experimental! Creates aCacheQuery
, filtered according to the givenHSQuery
.<E> CacheQuery<E>
getQuery(QueryDefinition queryDefinition, IndexedQueryMode indexedQueryMode, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> indexedTypeMap)
Creates a cache query based on aQueryDefinition
and a custom metadata.org.hibernate.search.stat.Statistics
getStatistics()
Get access to the Query specific statistics for this SearchManager instancevoid
purge(Class<?> entityType)
Remove all entities of particular class from the index.void
registerKeyTransformer(Class<?> keyClass, Class<? extends Transformer> transformerClass)
Registers aTransformer
for the supplied key class.void
setTimeoutExceptionFactory(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> T
unwrap(Class<T> cls)
This method gives access to internal Infinispan implementation details, and should not be normally needed.
-
-
-
Constructor Detail
-
SearchManagerImpl
public SearchManagerImpl(AdvancedCache<?,?> cache)
-
-
Method Detail
-
getQuery
public <E> CacheQuery<E> getQuery(org.apache.lucene.search.Query luceneQuery, IndexedQueryMode indexedQueryMode, Class<?>... classes)
Description copied from interface:SearchManager
This 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:
getQuery
in interfaceSearchManager
- Parameters:
luceneQuery
-Query
indexedQueryMode
- TheIndexedQueryMode
used when executing the query.classes
- Optionally only return results of type that matches this list of acceptable types.- Returns:
- the CacheQuery object which can be used to iterate through results.
-
getQuery
public <E> CacheQuery<E> getQuery(String queryString, IndexedQueryMode indexedQueryMode, Class<?>... classes)
Description copied from interface:SearchManager
Builds aCacheQuery
from an Ickle query string.- Specified by:
getQuery
in interfaceSearchManager
- See Also:
SearchManager.getQuery(Query, IndexedQueryMode, Class...)
-
getQuery
public <E> CacheQuery<E> getQuery(QueryDefinition queryDefinition, IndexedQueryMode indexedQueryMode, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> indexedTypeMap)
Description copied from interface:SearchManagerImplementor
Creates a cache query based on aQueryDefinition
and a custom metadata.- Specified by:
getQuery
in interfaceSearchManagerImplementor
-
getQuery
public <E> CacheQuery<E> getQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... classes)
- Specified by:
getQuery
in interfaceSearchManager
- See Also:
SearchManager.getQuery(Query, IndexedQueryMode, Class...)
-
getQuery
public <E> CacheQuery<E> getQuery(org.hibernate.search.query.engine.spi.HSQuery hSearchQuery, IndexedQueryMode queryMode)
Internal and experimental! Creates aCacheQuery
, filtered according to the givenHSQuery
.- Parameters:
hSearchQuery
-HSQuery
- Returns:
- the CacheQuery object which can be used to iterate through results
-
getClusteredQuery
@Deprecated public <E> CacheQuery<E> getClusteredQuery(org.apache.lucene.search.Query luceneQuery, Class<?>... classes)
Deprecated.- Specified by:
getClusteredQuery
in interfaceSearchManager
- Returns:
-
registerKeyTransformer
public void registerKeyTransformer(Class<?> keyClass, Class<? extends Transformer> transformerClass)
Description copied from interface:SearchManagerImplementor
Registers aTransformer
for the supplied key class. When storing keys in cache that are neither simple (String, int, ...) nor annotated with@Transformable
, Infinispan-Query will need to know whatTransformer
to use when transforming the keys to Strings. Clients must specify what Transformer to use for a particular key class by registering it through this method.WARNING: this method registers the transformer on the local node only (see https://issues.jboss.org/browse/ISPN-9513)
- Specified by:
registerKeyTransformer
in interfaceSearchManagerImplementor
- Parameters:
keyClass
- the key class for which the supplied transformerClass should be usedtransformerClass
- the transformer class to use for the supplied key class
-
setTimeoutExceptionFactory
public void setTimeoutExceptionFactory(org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory)
Description copied from interface:SearchManagerImplementor
Define the timeout exception factory to customize the exception thrown when the query timeout is exceeded.- Specified by:
setTimeoutExceptionFactory
in interfaceSearchManagerImplementor
- Parameters:
timeoutExceptionFactory
- the timeout exception factory to use
-
buildQueryBuilderForClass
public org.hibernate.search.query.dsl.EntityContext buildQueryBuilderForClass(Class<?> entityType)
Description copied from interface:SearchManager
Provides the Hibernate Search DSL entrypoint to build full text queries.- Specified by:
buildQueryBuilderForClass
in interfaceSearchManager
- Returns:
EntityContext
-
getMassIndexer
public MassIndexer getMassIndexer()
Description copied from interface:SearchManager
The MassIndexer can be used to rebuild the Lucene indexes from the entries stored in Infinispan.- Specified by:
getMassIndexer
in interfaceSearchManager
- Returns:
- the MassIndexer component
-
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
Description copied from interface:SearchManager
Retrieve an analyzer instance by its definition name- Specified by:
getAnalyzer
in 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:SearchManager
Get access to the Query specific statistics for this SearchManager instance- Specified by:
getStatistics
in interfaceSearchManager
- Returns:
- The statistics.
-
getAnalyzer
public org.apache.lucene.analysis.Analyzer getAnalyzer(Class<?> clazz)
Description copied from interface:SearchManager
Retrieves the scoped analyzer for a given class type.- Specified by:
getAnalyzer
in 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:SearchManager
Remove all entities of particular class from the index.- Specified by:
purge
in interfaceSearchManager
- Parameters:
entityType
- The class of the entity to remove.
-
unwrap
public <T> T unwrap(Class<T> cls)
Description copied from interface:SearchManager
This 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:
unwrap
in interfaceSearchManager
- Parameters:
cls
- the class of the desired internal component- Returns:
- the 'unwrapped' internal component
-
-