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:
java.lang.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, java.util.concurrent.ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, java.lang.Class<?>... classes)
ClusteredCacheQueryImpl(org.infinispan.query.impl.QueryDefinition queryDefinition, java.util.concurrent.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.int
getResultSize()
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
.java.util.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, java.util.concurrent.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
-
-
-
-
Constructor Detail
-
ClusteredCacheQueryImpl
public ClusteredCacheQueryImpl(org.apache.lucene.search.Query luceneQuery, org.hibernate.search.spi.SearchIntegrator searchFactory, java.util.concurrent.ExecutorService asyncExecutor, AdvancedCache<?,?> cache, org.infinispan.query.backend.KeyTransformationHandler keyTransformationHandler, java.lang.Class<?>... classes)
-
ClusteredCacheQueryImpl
public ClusteredCacheQueryImpl(org.infinispan.query.impl.QueryDefinition queryDefinition, java.util.concurrent.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:CacheQuery
Sets the maximum number of results to the number passed in as a parameter.- Specified by:
maxResults
in interfaceCacheQuery<E>
- Overrides:
maxResults
in 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.CacheQueryImpl
Sets the the result of the given integer value to the first result.- Specified by:
firstResult
in interfaceCacheQuery<E>
- Overrides:
firstResult
in classorg.infinispan.query.impl.CacheQueryImpl<E>
- Parameters:
firstResult
- index to be set.
-
getResultSize
public int getResultSize()
Description copied from interface:CacheQuery
Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).- Specified by:
getResultSize
in interfaceCacheQuery<E>
- Overrides:
getResultSize
in 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:CacheQuery
Returns the results of a search as aResultIterator
. Warning: the return type is an extension ofIterator
which introduces aResultIterator.close()
method. This close method needs to be invoked when the iteration is complete to avoid resource leakage.- Specified by:
iterator
in interfaceCacheQuery<E>
- Overrides:
iterator
in 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 java.util.List<E> list() throws org.hibernate.search.exception.SearchException
Description copied from interface:CacheQuery
Returns the results of a search as a list.- Specified by:
list
in interfaceCacheQuery<E>
- Overrides:
list
in 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, java.util.concurrent.TimeUnit timeUnit)
Description copied from interface:CacheQuery
Set the timeout for this query. If the query hasn't finished processing before the timeout, an exception will be thrown.- Specified by:
timeout
in interfaceCacheQuery<E>
- Overrides:
timeout
in classorg.infinispan.query.impl.CacheQueryImpl<E>
- Parameters:
timeout
- the timeout durationtimeUnit
- the time unit of the timeout parameter- Returns:
-
-