Class ClusteredCacheQueryImpl<E>

  • All Implemented Interfaces:
    Iterable<E>, CacheQuery<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>
    • 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 CacheQueryImpl<E>
        Parameters:
        maxResults - that are to be set to the maxResults.
      • 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 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 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 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 CacheQueryImpl<E>
        Parameters:
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter
        Returns: