public interface CacheQuery<E> extends Iterable<E>
SearchManagerImpl
. This object can
have methods such as list, setFirstResult,setMaxResults, setFetchSize, getResultSize and setSort.
SearchManagerImpl.getQuery(org.apache.lucene.search.Query, Class...)
Modifier and Type | Method and Description |
---|---|
CacheQuery<E> |
disableFullTextFilter(String name)
Disable a given filter by its name.
|
FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
Explanation |
explain(int documentId)
Return the Lucene
Explanation
object describing the score computation for the matching object/document
in the current query |
CacheQuery<E> |
filter(Filter f)
Allows lucene to filter the results.
|
CacheQuery<E> |
firstResult(int index)
Sets a result with a given index to the first result.
|
FacetManager |
getFacetManager() |
int |
getResultSize()
Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).
|
ResultIterator<E> |
iterator()
Returns the results of a search as a
ResultIterator . |
ResultIterator<E> |
iterator(FetchOptions fetchOptions)
Returns the results of a search as a
ResultIterator . |
List<E> |
list()
Returns the results of a search as a list.
|
CacheQuery<E> |
maxResults(int numResults)
Sets the maximum number of results to the number passed in as a parameter.
|
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. |
CacheQuery<E> |
sort(Sort s)
Allows lucene to sort the results.
|
CacheQuery<E> |
timeout(long timeout,
TimeUnit timeUnit)
Set the timeout for this query.
|
forEach, spliterator
List<E> list()
ResultIterator<E> iterator(FetchOptions fetchOptions)
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)ResultIterator<E> iterator()
ResultIterator
. This calls iterator(FetchOptions fetchOptions)
with default FetchOptions; this implies eager loading of all results.CacheQuery<E> firstResult(int index)
index
- of result to be set to the first.IllegalArgumentException
- if the index given is less than zero.CacheQuery<E> maxResults(int numResults)
numResults
- that are to be set to the maxResults.FacetManager getFacetManager()
int getResultSize()
Explanation explain(int documentId)
Explanation
object describing the score computation for the matching object/document
in the current querydocumentId
- Lucene Document id to be explain. This is NOT the object keyCacheQuery<E> sort(Sort s)
s
- - lucene sort objectCacheQuery<Object[]> projection(String... fields)
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 namesthis
to allow for method chaining, but the type parameter now becomes Object[]
FullTextFilter enableFullTextFilter(String name)
name
- of filter.CacheQuery<E> disableFullTextFilter(String name)
name
- of filter.CacheQuery<E> filter(Filter f)
f
- - lucene filterCacheQuery<E> timeout(long timeout, TimeUnit timeUnit)
timeout
- the timeout durationtimeUnit
- the time unit of the timeout parameterCopyright © 2018 JBoss, a division of Red Hat. All rights reserved.