Class CacheQueryImpl<E>

    • Field Detail

      • cache

        protected final org.infinispan.AdvancedCache<?,​?> cache
      • partitionHandlingSupport

        protected final org.infinispan.query.core.impl.PartitionHandlingSupport partitionHandlingSupport
    • Constructor Detail

      • CacheQueryImpl

        public CacheQueryImpl​(org.apache.lucene.search.Query luceneQuery,
                              org.hibernate.search.spi.SearchIntegrator searchFactory,
                              org.infinispan.AdvancedCache<?,​?> cache,
                              KeyTransformationHandler keyTransformationHandler,
                              org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory,
                              Class<?> entity)
        Create a CacheQueryImpl based on a Lucene query.
      • CacheQueryImpl

        public CacheQueryImpl​(org.hibernate.search.query.engine.spi.HSQuery hSearchQuery,
                              org.infinispan.AdvancedCache<?,​?> cache,
                              KeyTransformationHandler keyTransformationHandler)
        Create a CacheQueryImpl based on a HSQuery.
    • Method Detail

      • filter

        public IndexedQuery<E> filter​(org.apache.lucene.search.Filter filter)
        Takes in a lucene filter and sets it to the filter field in the class.
        Specified by:
        filter in interface CacheQuery<E>
        Parameters:
        filter - - lucene filter
      • 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>
        Returns:
        The result size of the query.
      • sort

        public IndexedQuery<E> sort​(org.apache.lucene.search.Sort sort)
        Description copied from interface: CacheQuery
        Allows lucene to sort the results. Integers are sorted in descending order.
        Specified by:
        sort in interface CacheQuery<E>
        Specified by:
        sort in interface IndexedQuery<E>
        Parameters:
        sort - - lucene sort object
      • enableFullTextFilter

        public org.hibernate.search.filter.FullTextFilter enableFullTextFilter​(String name)
        Enable a given filter by its name.
        Specified by:
        enableFullTextFilter in interface CacheQuery<E>
        Parameters:
        name - of filter.
        Returns:
        a FullTextFilter object.
      • maxResults

        public IndexedQuery<E> maxResults​(int maxResults)
        Description copied from interface: IndexedQuery
        Sets the maximum number of results to return from the query. Used for pagination.
        Specified by:
        maxResults in interface CacheQuery<E>
        Specified by:
        maxResults in interface IndexedQuery<E>
        Parameters:
        maxResults - the maximum number of results to return.
      • 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>
        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>
        Returns:
        the results of a search as a list.
        Throws:
        org.hibernate.search.exception.SearchException
      • getFacetManager

        public org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
        Specified by:
        getFacetManager in interface CacheQuery<E>
        Returns:
        return the manager for all faceting related operations
      • explain

        public org.apache.lucene.search.Explanation explain​(int documentId)
        Description copied from interface: CacheQuery
        Return the Lucene Explanation object describing the score computation for the matching object/document in the current query
        Specified by:
        explain in interface CacheQuery<E>
        Parameters:
        documentId - Lucene Document id to be explain. This is NOT the object key
        Returns:
        Lucene Explanation
      • projection

        public IndexedQuery<Object[]> projection​(String... fields)
        Description copied from interface: IndexedQuery
        Defines the Lucene field names projected and returned in a query result Each field is converted back to it's object representation, an Object[] being returned for each "row"

        A projectable field must be stored in the Lucene index and use a TwoWayFieldBridge Unless notified in their JavaDoc, all built-in bridges are two-way. All @DocumentId fields are projectable by design.

        If the projected field is not a projectable field, null is returned in the object[]

        Specified by:
        projection in interface CacheQuery<E>
        Specified by:
        projection in interface IndexedQuery<E>
        Parameters:
        fields - the projected field names
        Returns:
        this to allow for method chaining, but the type parameter now becomes Object[]
      • 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>
        Parameters:
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter
        Returns: