Package org.infinispan.query.impl
Interface IndexedQuery<E>
-
- All Superinterfaces:
CacheQuery<E>,Iterable<E>
- All Known Implementing Classes:
CacheQueryImpl,ClusteredCacheQueryImpl
public interface IndexedQuery<E> extends CacheQuery<E>
A distributed Lucene query.- Since:
- 11.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IndexedQuery<E>firstResult(int index)Sets the index of the first result, skipping the previous ones.List<E>list()Returns the results of a search as a list.IndexedQuery<E>maxResults(int numResults)Sets the maximum number of results to return from the query.IndexedQuery<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"IndexedQuery<E>sort(org.apache.lucene.search.Sort s)Allows lucene to sort the results.IndexedQuery<E>timeout(long timeout, TimeUnit timeUnit)Set the timeout for this query.-
Methods inherited from interface org.infinispan.query.CacheQuery
disableFullTextFilter, enableFullTextFilter, explain, filter, getFacetManager, getResultSize, iterator, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
sort
IndexedQuery<E> sort(org.apache.lucene.search.Sort s)
Description copied from interface:CacheQueryAllows lucene to sort the results. Integers are sorted in descending order.- Specified by:
sortin interfaceCacheQuery<E>- Parameters:
s- - lucene sort object
-
projection
IndexedQuery<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 aTwoWayFieldBridgeUnless 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:
projectionin interfaceCacheQuery<E>- Parameters:
fields- the projected field names- Returns:
thisto allow for method chaining, but the type parameter now becomesObject[]
-
list
List<E> list()
Description copied from interface:CacheQueryReturns the results of a search as a list.- Specified by:
listin interfaceCacheQuery<E>- Returns:
- the results of a search as a list.
-
firstResult
IndexedQuery<E> firstResult(int index)
Sets the index of the first result, skipping the previous ones. Used for pagination.- Specified by:
firstResultin interfaceCacheQuery<E>- Parameters:
index- of the first result- Throws:
IllegalArgumentException- if the index given is less than zero.
-
maxResults
IndexedQuery<E> maxResults(int numResults)
Sets the maximum number of results to return from the query. Used for pagination.- Specified by:
maxResultsin interfaceCacheQuery<E>- Parameters:
numResults- the maximum number of results to return.
-
timeout
IndexedQuery<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.- Specified by:
timeoutin interfaceCacheQuery<E>- Parameters:
timeout- the timeout durationtimeUnit- the time unit of the timeout parameter- Returns:
-
-