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

      • 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 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 CloseableIterator.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 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>
        Specified by:
        list in interface IndexedQuery<E>
        Overrides:
        list in class CacheQueryImpl<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: IndexedQuery
        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>
        Specified by:
        timeout in interface IndexedQuery<E>
        Overrides:
        timeout in class CacheQueryImpl<E>
        Parameters:
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter
        Returns: