Package org.infinispan.query.clustered
Class ClusteredCacheQueryImpl<E>
- java.lang.Object
-
- org.infinispan.query.impl.CacheQueryImpl<E>
-
- org.infinispan.query.clustered.ClusteredCacheQueryImpl<E>
-
- All Implemented Interfaces:
Iterable<E>,CacheQuery<E>
public final class ClusteredCacheQueryImpl<E> extends org.infinispan.query.impl.CacheQueryImpl<E>An extension of CacheQueryImpl used for distributed queries.- Since:
- 5.1
- Author:
- Israel Lacerra <israeldl@gmail.com>
-
-
Constructor Summary
Constructors Constructor Description ClusteredCacheQueryImpl(org.apache.lucene.search.Query luceneQuery, org.hibernate.search.spi.SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, Class<?>... classes)ClusteredCacheQueryImpl(org.infinispan.query.impl.QueryDefinition queryDefinition, ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> metadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheQuery<E>firstResult(int firstResult)Sets the the result of the given integer value to the first result.intgetResultSize()Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).ResultIterator<E>iterator(FetchOptions fetchOptions)Returns the results of a search as aResultIterator.List<E>list()Returns the results of a search as a list.CacheQuery<E>maxResults(int maxResults)Sets the maximum number of results to the number passed in as a parameter.CacheQuery<E>timeout(long timeout, TimeUnit timeUnit)Set the timeout for this query.-
Methods inherited from class org.infinispan.query.impl.CacheQueryImpl
disableFullTextFilter, enableFullTextFilter, explain, filter, getFacetManager, iterator, projection, sort
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
ClusteredCacheQueryImpl
public ClusteredCacheQueryImpl(org.apache.lucene.search.Query luceneQuery, org.hibernate.search.spi.SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, Class<?>... classes)
-
ClusteredCacheQueryImpl
public ClusteredCacheQueryImpl(org.infinispan.query.impl.QueryDefinition queryDefinition, ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> metadata)
-
-
Method Detail
-
maxResults
public CacheQuery<E> maxResults(int maxResults)
Description copied from interface:CacheQuerySets the maximum number of results to the number passed in as a parameter.- Specified by:
maxResultsin interfaceCacheQuery<E>- Overrides:
maxResultsin classorg.infinispan.query.impl.CacheQueryImpl<E>- Parameters:
maxResults- that are to be set to the maxResults.
-
firstResult
public CacheQuery<E> firstResult(int firstResult)
Description copied from class:org.infinispan.query.impl.CacheQueryImplSets the the result of the given integer value to the first result.- Specified by:
firstResultin interfaceCacheQuery<E>- Overrides:
firstResultin classorg.infinispan.query.impl.CacheQueryImpl<E>- Parameters:
firstResult- index to be set.
-
getResultSize
public int getResultSize()
Description copied from interface:CacheQueryGets the total number of results matching the query, ignoring pagination (firstResult, maxResult).- Specified by:
getResultSizein interfaceCacheQuery<E>- Overrides:
getResultSizein classorg.infinispan.query.impl.CacheQueryImpl<E>- Returns:
- The result size of the query.
-
iterator
public ResultIterator<E> iterator(FetchOptions fetchOptions) throws org.hibernate.search.exception.SearchException
Description copied from interface:CacheQueryReturns the results of a search as aResultIterator. Warning: the return type is an extension ofIteratorwhich introduces aResultIterator.close()method. This close method needs to be invoked when the iteration is complete to avoid resource leakage.- Specified by:
iteratorin interfaceCacheQuery<E>- Overrides:
iteratorin classorg.infinispan.query.impl.CacheQueryImpl<E>- Parameters:
fetchOptions- how to fetch results (see @link FetchOptions)- Returns:
- a QueryResultIterator which can be used to iterate through the results that were found.
- Throws:
org.hibernate.search.exception.SearchException
-
list
public List<E> list() throws org.hibernate.search.exception.SearchException
Description copied from interface:CacheQueryReturns the results of a search as a list.- Specified by:
listin interfaceCacheQuery<E>- Overrides:
listin classorg.infinispan.query.impl.CacheQueryImpl<E>- Returns:
- list of objects that were found from the search.
- Throws:
org.hibernate.search.exception.SearchException
-
timeout
public CacheQuery<E> timeout(long timeout, TimeUnit timeUnit)
Description copied from interface:CacheQuerySet the timeout for this query. If the query hasn't finished processing before the timeout, an exception will be thrown.- Specified by:
timeoutin interfaceCacheQuery<E>- Overrides:
timeoutin classorg.infinispan.query.impl.CacheQueryImpl<E>- Parameters:
timeout- the timeout durationtimeUnit- the time unit of the timeout parameter- Returns:
-
-