Class IndexedQueryImpl<E>

java.lang.Object
org.infinispan.query.impl.IndexedQueryImpl<E>
All Implemented Interfaces:
IndexedQuery<E>
Direct Known Subclasses:
DistributedIndexedQueryImpl

public class IndexedQueryImpl<E> extends Object implements IndexedQuery<E>
Lucene based indexed query implementation.
Author:
Navin Surtani, Sanne Grinovero <sanne@hibernate.org> (C) 2011 Red Hat Inc., Marko Luksa
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.infinispan.AdvancedCache<?,?>
     
    protected final org.infinispan.query.core.impl.PartitionHandlingSupport
     
    protected final QueryDefinition
     
    protected final org.infinispan.query.core.stats.impl.LocalQueryStatistics
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    IndexedQueryImpl(String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, SearchQueryBuilder searchQuery, org.infinispan.AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics, int defaultMaxResults)
    Create a IndexedQueryImpl based on a SearchQuery.
    IndexedQueryImpl(QueryDefinition queryDefinition, org.infinispan.AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.infinispan.query.dsl.QueryResult<?>
     
    <K> org.infinispan.commons.util.CloseableIterator<Map.Entry<K,E>>
    Returns the matching entries (both key and value).
    org.infinispan.query.dsl.QueryResult<?>
    Executes an Ickle statement returning results (query aka.
    int
    Executes an Ickle statement not returning any results (ie.
    firstResult(int firstResult)
    Sets the result of the given integer value to the first result.
    int
     
    hitCountAccuracy(int hitCountAccuracy)
    Limit the required accuracy of the hit count for the indexed queries to an upper-bound.
    org.infinispan.commons.util.CloseableIterator<E>
     
    maxResults(int maxResults)
    Sets the maximum number of results to return from the query.
    timeout(long timeout, TimeUnit timeUnit)
    Set the timeout for this query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.infinispan.query.impl.IndexedQuery

    list
  • Field Details

    • cache

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

      protected final org.infinispan.query.core.impl.PartitionHandlingSupport partitionHandlingSupport
    • queryDefinition

      protected final QueryDefinition queryDefinition
    • queryStatistics

      protected final org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics
  • Constructor Details

    • IndexedQueryImpl

      public IndexedQueryImpl(QueryDefinition queryDefinition, org.infinispan.AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics)
    • IndexedQueryImpl

      public IndexedQueryImpl(String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, SearchQueryBuilder searchQuery, org.infinispan.AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics, int defaultMaxResults)
      Create a IndexedQueryImpl based on a SearchQuery.
  • Method Details

    • getResultSize

      public int getResultSize()
      Specified by:
      getResultSize in interface IndexedQuery<E>
      Returns:
      The result size of the query.
    • firstResult

      public IndexedQuery<E> firstResult(int firstResult)
      Sets the result of the given integer value to the first result.
      Specified by:
      firstResult in interface IndexedQuery<E>
      Parameters:
      firstResult - index to be set.
      Throws:
      IllegalArgumentException - if the index given is less than zero.
    • 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 IndexedQuery<E>
      Parameters:
      maxResults - the maximum number of results to return.
    • hitCountAccuracy

      public IndexedQuery<E> hitCountAccuracy(int hitCountAccuracy)
      Description copied from interface: IndexedQuery
      Limit the required accuracy of the hit count for the indexed queries to an upper-bound. Setting the hit-count-accuracy could improve the performance of queries targeting large data sets.
      Specified by:
      hitCountAccuracy in interface IndexedQuery<E>
      Parameters:
      hitCountAccuracy - The value to apply
      Returns:
      this, for method chaining
    • iterator

      public org.infinispan.commons.util.CloseableIterator<E> iterator() throws org.hibernate.search.util.common.SearchException
      Specified by:
      iterator in interface IndexedQuery<E>
      Throws:
      org.hibernate.search.util.common.SearchException
    • entryIterator

      public <K> org.infinispan.commons.util.CloseableIterator<Map.Entry<K,E>> entryIterator()
      Description copied from interface: IndexedQuery
      Returns the matching entries (both key and value).

      NOTE: The query must not contain any projections or an exception will be thrown.

      Specified by:
      entryIterator in interface IndexedQuery<E>
    • execute

      public org.infinispan.query.dsl.QueryResult<?> execute()
      Description copied from interface: IndexedQuery
      Executes an Ickle statement returning results (query aka. SELECT). If the statement happens to be a DELETE it redirects it to IndexedQuery.executeStatement().

      NOTE: Paging params (firstResult/maxResults) are honoured for SELECT and dissalowed for DELETE.

      Specified by:
      execute in interface IndexedQuery<E>
    • aggregation

      public org.infinispan.query.dsl.QueryResult<?> aggregation()
    • executeStatement

      public int executeStatement()
      Description copied from interface: IndexedQuery
      Executes an Ickle statement not returning any results (ie. DELETE).

      NOTE: Paging params (firstResult/maxResults) are NOT allowed.

      Specified by:
      executeStatement in interface IndexedQuery<E>
      Returns:
      the number of affected entries
    • 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 IndexedQuery<E>
      Parameters:
      timeout - the timeout duration
      timeUnit - the time unit of the timeout parameter