|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HSQuery
Defines and executes an Hibernate Search query (wrapping a Lucene query).
Uses fluent APIs to define the query and offer a few alternatives
on how to execute the query.
This object is not meant to be thread safe.
The typical usage is as follow
//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
Field Summary |
---|
Fields inherited from interface org.hibernate.search.ProjectionConstants |
---|
DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, THIS |
Method Summary | |
---|---|
void |
afterDeserialise(SearchFactoryImplementor searchFactory)
|
void |
disableFullTextFilter(String name)
Disable a given filter by its name. |
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 |
HSQuery |
filter(org.apache.lucene.search.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 |
org.apache.lucene.search.Query |
getLuceneQuery()
|
String[] |
getProjectedFields()
|
SearchFactoryImplementor |
getSearchFactoryImplementor()
Deprecated. should be at most SearchFactoryIntegrator, preferably removed altogether |
List<Class<?>> |
getTargetedEntities()
|
TimeoutManager |
getTimeoutManager()
|
HSQuery |
luceneQuery(org.apache.lucene.search.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 |
sort(org.apache.lucene.search.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. |
Method Detail |
---|
HSQuery luceneQuery(org.apache.lucene.search.Query query)
query
- the Lucene query
this
to allow method chainingHSQuery targetedEntities(List<Class<?>> classes)
classes
- the list of classes (indexes) targeted by this query
this
to allow for method chainingHSQuery sort(org.apache.lucene.search.Sort sort)
sort
- The Lucene sort object.
this
to allow for method chainingHSQuery filter(org.apache.lucene.search.Filter filter)
filter
- The Lucene filter.
this
to allow for method chainingHSQuery timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
QueryTimeoutException
exceptionFactory
- the timeout exception factory to use
this
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 names
this
to allow for method chainingHSQuery firstResult(int firstResult)
firstResult
- a element number, numbered from 0
this
to allow for method chainingHSQuery maxResults(int maxResults)
maxResults
- the maximum number of elements
this
in order to allow method chainingList<Class<?>> getTargetedEntities()
Set<Class<?>> getIndexedTargetedEntities()
String[] getProjectedFields()
TimeoutManager getTimeoutManager()
timeoutManager.start()
and timeoutManager.stop()
.FacetManager getFacetManager()
org.apache.lucene.search.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()
org.apache.lucene.search.Explanation explain(int documentId)
Explanation
object describing the score computation for the matching object/document
in the current query
documentId
- Lucene Document id to be explain. This is NOT the object id
FullTextFilter enableFullTextFilter(String name)
name
- the name of the filter to enable
FullTextFilter
object that allows filter parameter injectionvoid disableFullTextFilter(String name)
name
- the name of the filter to disable.SearchFactoryImplementor getSearchFactoryImplementor()
SearchFactoryImplementor
instancevoid afterDeserialise(SearchFactoryImplementor searchFactory)
searchFactory
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |