public interface CacheQuery
extends java.lang.Iterable<java.lang.Object>
SearchManagerImpl
. This object can
have methods such as list, setFirstResult,setMaxResults, setFetchSize, getResultSize and setSort.
SearchManagerImpl#getQuery(org.apache.lucene.search.Query)
Modifier and Type | Method and Description |
---|---|
CacheQuery |
disableFullTextFilter(java.lang.String name)
Disable a given filter by its name.
|
FullTextFilter |
enableFullTextFilter(java.lang.String name)
Enable a given filter by its name.
|
Explanation |
explain(int documentId)
Return the Lucene
org.apache.lucene.search.Explanation
object describing the score computation for the matching object/document
in the current query |
CacheQuery |
filter(Filter f)
Allows lucene to filter the results.
|
CacheQuery |
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 |
iterator()
Returns the results of a search as a
ResultIterator . |
ResultIterator |
iterator(FetchOptions fetchOptions)
Returns the results of a search as a
ResultIterator . |
java.util.List<java.lang.Object> |
list()
Returns the results of a search as a list.
|
CacheQuery |
maxResults(int numResults)
Sets the maximum number of results to the number passed in as a parameter.
|
CacheQuery |
projection(java.lang.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
org.hibernate.search.bridge.TwoWayFieldBridge
Unless notified in their JavaDoc, all built-in bridges are two-way. |
CacheQuery |
sort(Sort s)
Allows lucene to sort the results.
|
CacheQuery |
timeout(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Set the timeout for this query.
|
java.util.List<java.lang.Object> list()
ResultIterator 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 iterator()
ResultIterator
. This calls iterator(FetchOptions fetchOptions)
with default FetchOptions; this implies eager loading of all results.iterator
in interface java.lang.Iterable<java.lang.Object>
CacheQuery firstResult(int index)
index
- of result to be set to the first.java.lang.IllegalArgumentException
- if the index given is less than zero.CacheQuery maxResults(int numResults)
numResults
- that are to be set to the maxResults.FacetManager getFacetManager()
int getResultSize()
Explanation explain(int documentId)
org.apache.lucene.search.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 sort(Sort s)
s
- - lucene sort objectCacheQuery projection(java.lang.String... fields)
org.hibernate.search.bridge.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 chainingFullTextFilter enableFullTextFilter(java.lang.String name)
name
- of filter.CacheQuery disableFullTextFilter(java.lang.String name)
name
- of filter.CacheQuery filter(Filter f)
f
- - lucene filterCacheQuery timeout(long timeout, java.util.concurrent.TimeUnit timeUnit)
timeout
- the timeout durationtimeUnit
- the time unit of the timeout parameter