Interface CacheQuery<E>

    • Method Detail

      • list

        List<E> list()
        Returns the results of a search as a list.
        Returns:
        list of objects that were found from the search.
      • iterator

        ResultIterator<E> iterator​(FetchOptions fetchOptions)
        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.
        Parameters:
        fetchOptions - how to fetch results (see @link FetchOptions)
        Returns:
        a QueryResultIterator which can be used to iterate through the results that were found.
      • firstResult

        CacheQuery<E> firstResult​(int index)
        Sets a result with a given index to the first result.
        Parameters:
        index - of result to be set to the first.
        Throws:
        IllegalArgumentException - if the index given is less than zero.
      • maxResults

        CacheQuery<E> maxResults​(int numResults)
        Sets the maximum number of results to the number passed in as a parameter.
        Parameters:
        numResults - that are to be set to the maxResults.
      • getFacetManager

        org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
        Returns:
        return the manager for all faceting related operations
      • getResultSize

        int getResultSize()
        Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).
        Returns:
        total number of results.
      • explain

        org.apache.lucene.search.Explanation explain​(int documentId)
        Return the Lucene Explanation object describing the score computation for the matching object/document in the current query
        Parameters:
        documentId - Lucene Document id to be explain. This is NOT the object key
        Returns:
        Lucene Explanation
      • sort

        CacheQuery<E> sort​(org.apache.lucene.search.Sort s)
        Allows lucene to sort the results. Integers are sorted in descending order.
        Parameters:
        s - - lucene sort object
      • projection

        CacheQuery<Object[]> projection​(String... fields)
        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[]

        Parameters:
        fields - the projected field names
        Returns:
        this to allow for method chaining, but the type parameter now becomes Object[]
      • enableFullTextFilter

        org.hibernate.search.filter.FullTextFilter enableFullTextFilter​(String name)
        Enable a given filter by its name.
        Parameters:
        name - of filter.
        Returns:
        a FullTextFilter object.
      • disableFullTextFilter

        CacheQuery<E> disableFullTextFilter​(String name)
        Disable a given filter by its name.
        Parameters:
        name - of filter.
      • filter

        CacheQuery<E> filter​(org.apache.lucene.search.Filter f)
        Allows lucene to filter the results.
        Parameters:
        f - - lucene filter
      • timeout

        CacheQuery<E> timeout​(long timeout,
                              TimeUnit timeUnit)
        Set the timeout for this query. If the query hasn't finished processing before the timeout, an exception will be thrown.
        Parameters:
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter
        Returns: