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>,IndexedQuery<E>
public final class ClusteredCacheQueryImpl<E> extends CacheQueryImpl<E>
An extension of CacheQueryImpl used for distributed queries.- Since:
- 5.1
- Author:
- Israel Lacerra <israeldl@gmail.com>
-
-
Field Summary
-
Fields inherited from class org.infinispan.query.impl.CacheQueryImpl
cache, keyTransformationHandler, partitionHandlingSupport, queryDefinition
-
-
Constructor Summary
Constructors Constructor Description ClusteredCacheQueryImpl(QueryDefinition queryDefinition, ExecutorService asyncExecutor, org.infinispan.AdvancedCache<?,?> cache, 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 IndexedQuery<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.IndexedQuery<E>maxResults(int maxResults)Sets the maximum number of results to return from the query.IndexedQuery<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(QueryDefinition queryDefinition, ExecutorService asyncExecutor, org.infinispan.AdvancedCache<?,?> cache, KeyTransformationHandler keyTransformationHandler, org.hibernate.search.spi.IndexedTypeMap<org.hibernate.search.spi.CustomTypeMetadata> metadata)
-
-
Method Detail
-
maxResults
public IndexedQuery<E> maxResults(int maxResults)
Description copied from interface:IndexedQuerySets the maximum number of results to return from the query. Used for pagination.- Specified by:
maxResultsin interfaceCacheQuery<E>- Specified by:
maxResultsin interfaceIndexedQuery<E>- Overrides:
maxResultsin classCacheQueryImpl<E>- Parameters:
maxResults- the maximum number of results to return.
-
firstResult
public IndexedQuery<E> firstResult(int firstResult)
Description copied from class:CacheQueryImplSets the the result of the given integer value to the first result.- Specified by:
firstResultin interfaceCacheQuery<E>- Specified by:
firstResultin interfaceIndexedQuery<E>- Overrides:
firstResultin classCacheQueryImpl<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 classCacheQueryImpl<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 aCloseableIterator.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 classCacheQueryImpl<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>- Specified by:
listin interfaceIndexedQuery<E>- Overrides:
listin classCacheQueryImpl<E>- Returns:
- the results of a search as a list.
- Throws:
org.hibernate.search.exception.SearchException
-
timeout
public IndexedQuery<E> timeout(long timeout, TimeUnit timeUnit)
Description copied from interface:IndexedQuerySet 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>- Specified by:
timeoutin interfaceIndexedQuery<E>- Overrides:
timeoutin classCacheQueryImpl<E>- Parameters:
timeout- the timeout durationtimeUnit- the time unit of the timeout parameter- Returns:
-
-