Interface CacheQuery<E>

  • All Superinterfaces:
    All Known Implementing Classes:
    org.infinispan.query.impl.CacheQueryImpl, ClusteredCacheQueryImpl

    public interface CacheQuery<E>
    extends Iterable<E>
    A cache-query is what will be returned when the getQuery() method is run on SearchManagerImpl. This object can have methods such as list, setFirstResult,setMaxResults, setFetchSize, getResultSize and setSort.

    Manik Surtani, Navin Surtani, Sanne Grinovero <> (C) 2011 Red Hat Inc., Marko Luksa
    See Also:
    SearchManagerImpl.getQuery(, Class...)
    • Method Detail

      • list

        List<E> list()
        Returns the results of a search as a list.
        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.
        fetchOptions - how to fetch results (see @link FetchOptions)
        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.
        index - of result to be set to the first.
        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.
        numResults - that are to be set to the maxResults.
      • getFacetManager getFacetManager()
        return the manager for all faceting related operations
      • getResultSize

        int getResultSize()
        Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).
        total number of results.
      • explain explain​(int documentId)
        Return the Lucene Explanation object describing the score computation for the matching object/document in the current query
        documentId - Lucene Document id to be explain. This is NOT the object key
        Lucene Explanation
      • sort

        CacheQuery<E> sort​( s)
        Allows lucene to sort the results. Integers are sorted in descending order.
        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[]

        fields - the projected field names
        this to allow for method chaining, but the type parameter now becomes Object[]
      • enableFullTextFilter enableFullTextFilter​(String name)
        Enable a given filter by its name.
        name - of filter.
        a FullTextFilter object.
      • disableFullTextFilter

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

        CacheQuery<E> filter​( f)
        Allows lucene to filter the results.
        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.
        timeout - the timeout duration
        timeUnit - the time unit of the timeout parameter