public interface HSQuery extends ProjectionConstants
//get query object
HSQuery query = searchFactoryIngegrator.createHSQuery();
//configure query object
query
.luceneQuery( luceneQuery )
.timeoutExceptionFactory( exceptionFactory )
.targetedEntities( Arrays.asList( classes ) );
[...]
//start timeout counting
query.getTimeoutManager().start();
//query execution and use
List entityInfos = query.getEntityInfos();
[...]
//done with the core of the query
query.getTimeoutManager().stop();
DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS
Modifier and Type | Method and Description |
---|---|
void |
afterDeserialise(SearchFactoryImplementor searchFactory)
afterDeserialise.
|
void |
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 |
HSQuery |
filter(Filter filter)
Allows to use lucene filters.
|
HSQuery |
firstResult(int firstResult)
Set the first element to retrieve.
|
FacetManager |
getFacetManager() |
Set<Class<?>> |
getIndexedTargetedEntities()
WTF does that do exactly
|
Query |
getLuceneQuery() |
String[] |
getProjectedFields() |
SearchFactoryImplementor |
getSearchFactoryImplementor()
Deprecated.
should be at most SearchFactoryIntegrator, preferably removed altogether
|
List<Class<?>> |
getTargetedEntities() |
TimeoutManager |
getTimeoutManager() |
HSQuery |
luceneQuery(Query query)
Defines the underlying Lucene query
|
HSQuery |
maxResults(int maxResults)
Set the maximum number of elements to retrieve.
|
HSQuery |
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"
(similar to an HQL or a Criteria API projection).
|
DocumentExtractor |
queryDocumentExtractor()
Execute the Lucene query and return a traversable object over the results.
|
List<EntityInfo> |
queryEntityInfos()
Execute the Lucene query and return the list of
EntityInfo s populated with
metadata and projection. |
int |
queryResultSize() |
HSQuery |
setSpatialParameters(Coordinates center,
String fieldName)
setSpatialParameters.
|
HSQuery |
sort(Sort sort)
Lets Lucene sort the results.
|
HSQuery |
targetedEntities(List<Class<?>> classes)
Defines the targeted entities.
|
HSQuery |
timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
Define the timeout exception factory to customize the exception returned by the user.
|
HSQuery luceneQuery(Query query)
query
- the Lucene querythis
to allow method chainingHSQuery targetedEntities(List<Class<?>> classes)
classes
- the list of classes (indexes) targeted by this querythis
to allow for method chainingHSQuery sort(Sort sort)
sort
- The Lucene sort object.this
to allow for method chainingHSQuery filter(Filter filter)
filter
- The Lucene filter.this
to allow for method chainingHSQuery timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
QueryTimeoutException
exceptionFactory
- the timeout exception factory to usethis
to allow for method chainingHSQuery 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 chainingHSQuery firstResult(int firstResult)
firstResult
- a element number, numbered from 0this
to allow for method chainingHSQuery maxResults(int maxResults)
maxResults
- the maximum number of elementsthis
in order to allow method chainingString[] getProjectedFields()
TimeoutManager getTimeoutManager()
timeoutManager.start()
and timeoutManager.stop()
.FacetManager getFacetManager()
Query getLuceneQuery()
List<EntityInfo> queryEntityInfos()
EntityInfo
s populated with
metadata and projection. ProjectionConstants.THIS
if projected is EntityInfo
s populated with metadata and projectionDocumentExtractor queryDocumentExtractor()
ProjectionConstants.THIS
if projected is DocumentExtractor
DocumentExtractor
instanceint queryResultSize()
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 idFullTextFilter enableFullTextFilter(String name)
name
- the name of the filter to enableFullTextFilter
object that allows filter parameter injectionvoid disableFullTextFilter(String name)
name
- the name of the filter to disable.SearchFactoryImplementor getSearchFactoryImplementor()
getSearchFactoryImplementor.
SearchFactoryImplementor
instancevoid afterDeserialise(SearchFactoryImplementor searchFactory)
afterDeserialise.
searchFactory
- a SearchFactoryImplementor
object.HSQuery setSpatialParameters(Coordinates center, String fieldName)
setSpatialParameters.
center
- center of the spatial searchfieldName
- name ot the spatial fieldthis
to allow for method chainingCopyright © 2006-2014 Red Hat, Inc. All Rights Reserved