public class CacheQueryImpl extends Object implements CacheQuery
| Modifier and Type | Field and Description |
|---|---|
protected AdvancedCache<?,?> |
cache |
protected org.hibernate.search.query.engine.spi.HSQuery |
hSearchQuery |
protected KeyTransformationHandler |
keyTransformationHandler |
| Constructor and Description |
|---|
CacheQueryImpl(org.apache.lucene.search.Query luceneQuery,
org.hibernate.search.spi.SearchFactoryIntegrator searchFactory,
AdvancedCache<?,?> cache,
KeyTransformationHandler keyTransformationHandler,
Class<?>... classes) |
CacheQueryImpl(org.apache.lucene.search.Query luceneQuery,
org.hibernate.search.spi.SearchFactoryIntegrator searchFactory,
AdvancedCache<?,?> cache,
KeyTransformationHandler keyTransformationHandler,
org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory,
Class<?>... classes) |
| Modifier and Type | Method and Description |
|---|---|
CacheQuery |
disableFullTextFilter(String name)
Disable a given filter by its name.
|
org.hibernate.search.FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
org.apache.lucene.search.Explanation |
explain(int documentId)
Return the Lucene
Explanation
object describing the score computation for the matching object/document
in the current query |
CacheQuery |
filter(org.apache.lucene.search.Filter filter)
Takes in a lucene filter and sets it to the filter field in the class.
|
CacheQuery |
firstResult(int firstResult)
Sets the the result of the given integer value to the first result.
|
org.hibernate.search.query.engine.spi.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. |
List<Object> |
list()
Returns the results of a search as a list.
|
CacheQuery |
maxResults(int maxResults)
Sets the maximum number of results to the number passed in as a parameter.
|
CacheQuery |
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 |
sort(org.apache.lucene.search.Sort sort)
Allows lucene to sort the results.
|
CacheQuery |
timeout(long timeout,
TimeUnit timeUnit)
Set the timeout for this query.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorprotected final AdvancedCache<?,?> cache
protected final KeyTransformationHandler keyTransformationHandler
protected org.hibernate.search.query.engine.spi.HSQuery hSearchQuery
public CacheQueryImpl(org.apache.lucene.search.Query luceneQuery,
org.hibernate.search.spi.SearchFactoryIntegrator searchFactory,
AdvancedCache<?,?> cache,
KeyTransformationHandler keyTransformationHandler,
Class<?>... classes)
public CacheQueryImpl(org.apache.lucene.search.Query luceneQuery,
org.hibernate.search.spi.SearchFactoryIntegrator searchFactory,
AdvancedCache<?,?> cache,
KeyTransformationHandler keyTransformationHandler,
org.hibernate.search.query.engine.spi.TimeoutExceptionFactory timeoutExceptionFactory,
Class<?>... classes)
public CacheQuery filter(org.apache.lucene.search.Filter filter)
filter in interface CacheQueryfilter - - lucene filterpublic int getResultSize()
CacheQuerygetResultSize in interface CacheQuerypublic CacheQuery sort(org.apache.lucene.search.Sort sort)
CacheQuerysort in interface CacheQuerysort - - lucene sort objectpublic org.hibernate.search.FullTextFilter enableFullTextFilter(String name)
enableFullTextFilter in interface CacheQueryname - of filter.public CacheQuery disableFullTextFilter(String name)
disableFullTextFilter in interface CacheQueryname - of filter.public CacheQuery firstResult(int firstResult)
firstResult in interface CacheQueryfirstResult - index to be set.IllegalArgumentException - if the index given is less than zero.public CacheQuery maxResults(int maxResults)
CacheQuerymaxResults in interface CacheQuerymaxResults - that are to be set to the maxResults.public ResultIterator iterator() throws org.hibernate.search.SearchException
CacheQueryResultIterator. This calls CacheQuery.iterator(FetchOptions fetchOptions)
with default FetchOptions; this implies eager loading of all results.iterator in interface Iterable<Object>iterator in interface CacheQueryorg.hibernate.search.SearchExceptionpublic ResultIterator iterator(FetchOptions fetchOptions) throws org.hibernate.search.SearchException
CacheQueryResultIterator.
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.iterator in interface CacheQueryfetchOptions - how to fetch results (see @link FetchOptions)org.hibernate.search.SearchExceptionpublic List<Object> list() throws org.hibernate.search.SearchException
CacheQuerylist in interface CacheQueryorg.hibernate.search.SearchExceptionpublic org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
getFacetManager in interface CacheQuerypublic org.apache.lucene.search.Explanation explain(int documentId)
CacheQueryExplanation
object describing the score computation for the matching object/document
in the current queryexplain in interface CacheQuerydocumentId - Lucene Document id to be explain. This is NOT the object keypublic CacheQuery projection(String... fields)
CacheQueryTwoWayFieldBridge
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[]projection in interface CacheQueryfields - the projected field namesthis to allow for method chainingpublic CacheQuery timeout(long timeout, TimeUnit timeUnit)
CacheQuerytimeout in interface CacheQuerytimeout - the timeout durationtimeUnit - the time unit of the timeout parameterCopyright © 2014 JBoss, a division of Red Hat. All rights reserved.