Package org.infinispan.query.impl
Class IndexedQueryImpl<E>
- java.lang.Object
-
- org.infinispan.query.impl.IndexedQueryImpl<E>
-
- All Implemented Interfaces:
IndexedQuery<E>
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 AdvancedCache<?,?>
cache
protected org.infinispan.query.core.impl.PartitionHandlingSupport
partitionHandlingSupport
protected QueryDefinition
queryDefinition
protected org.infinispan.query.core.stats.impl.LocalQueryStatistics
queryStatistics
-
Constructor Summary
Constructors Constructor Description IndexedQueryImpl(String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, org.infinispan.query.dsl.embedded.impl.SearchQueryBuilder searchQuery, AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics, int defaultMaxResults)
Create a IndexedQueryImpl based on a SearchQuery.IndexedQueryImpl(QueryDefinition queryDefinition, AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K> CloseableIterator<Map.Entry<K,E>>
entryIterator()
Returns the matching entries (both key and value).QueryResult<?>
execute()
Executes an Ickle statement returning results (query aka.int
executeStatement()
Executes an Ickle statement not returning any results (ie.IndexedQuery<E>
firstResult(int firstResult)
Sets the result of the given integer value to the first result.int
getResultSize()
CloseableIterator<E>
iterator()
IndexedQuery<E>
maxResults(int maxResults)
Sets the maximum number of results to return from the query.IndexedQuery<E>
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 Detail
-
cache
protected final 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 Detail
-
IndexedQueryImpl
public IndexedQueryImpl(QueryDefinition queryDefinition, AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics)
-
IndexedQueryImpl
public IndexedQueryImpl(String queryString, org.infinispan.objectfilter.impl.syntax.parser.IckleParsingResult.StatementType statementType, org.infinispan.query.dsl.embedded.impl.SearchQueryBuilder searchQuery, AdvancedCache<?,?> cache, org.infinispan.query.core.stats.impl.LocalQueryStatistics queryStatistics, int defaultMaxResults)
Create a IndexedQueryImpl based on a SearchQuery.
-
-
Method Detail
-
getResultSize
public int getResultSize()
- Specified by:
getResultSize
in interfaceIndexedQuery<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 interfaceIndexedQuery<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 interfaceIndexedQuery<E>
- Parameters:
maxResults
- the maximum number of results to return.
-
iterator
public CloseableIterator<E> iterator() throws org.hibernate.search.util.common.SearchException
- Specified by:
iterator
in interfaceIndexedQuery<E>
- Throws:
org.hibernate.search.util.common.SearchException
-
entryIterator
public <K> 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 interfaceIndexedQuery<E>
-
execute
public 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 toIndexedQuery.executeStatement()
.NOTE: Paging params (firstResult/maxResults) are honoured for SELECT and dissalowed for DELETE.
- Specified by:
execute
in interfaceIndexedQuery<E>
-
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 interfaceIndexedQuery<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 interfaceIndexedQuery<E>
- Parameters:
timeout
- the timeout durationtimeUnit
- the time unit of the timeout parameter
-
-