Class 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>
    • Field Summary

      • Fields inherited from class org.infinispan.query.impl.CacheQueryImpl

        cache, keyTransformationHandler, partitionHandlingSupport, queryDefinition
    • 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)  
    • 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: CacheQuery
        Sets the maximum number of results to the number passed in as a parameter.
        Specified by:
        maxResults in interface CacheQuery<E>
        Overrides:
        maxResults in class org.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 interface CacheQuery<E>
        Overrides:
        firstResult in class org.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 interface CacheQuery<E>
        Overrides:
        getResultSize in class org.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 a ResultIterator. Warning: the return type is an extension of Iterator which introduces a ResultIterator.close() method. This close method needs to be invoked when the iteration is complete to avoid resource leakage.
        Specified by:
        iterator in interface CacheQuery<E>
        Overrides:
        iterator in class org.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: CacheQuery
        Returns the results of a search as a list.
        Specified by:
        list in interface CacheQuery<E>
        Overrides:
        list in class org.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: 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 interface CacheQuery<E>
        Overrides:
        timeout in class org.infinispan.query.impl.CacheQueryImpl<E>
        Parameters:
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter
        Returns: