Class HSQueryImpl
java.lang.Object
org.hibernate.search.query.engine.impl.HSQueryImpl
- All Implemented Interfaces:
ProjectionConstants,HSQuery
-
Field Summary
Fields inherited from interface org.hibernate.search.ProjectionConstants
BOOST, DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, THIS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisableFullTextFilter(String name) Disable a given filter by its name.enableFullTextFilter(String name) Enable a given filter by its name.explain(int documentId) Return the LuceneExplanationobject describing the score computation for the matching object/document in the current queryAllows to use lucene filters.firstResult(int firstResult) Set the first element to retrieve.Set of indexed entities corresponding to the class hierarchy of the targeted entitiesString[]List of targeted entities as described by the userluceneQuery(Query query) Defines the underlying Lucene querymaxResults(Integer maxResults) Set the maximum number of elements to retrieve.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 returns a traverser over the full-text results (EntityInfo) This operation is lazy bound: - the query is executed - results are not retrieved until actually requested DocumentExtractor objects *must* be closed when the results are no longer traversed.Execute the Lucene query and return the list ofEntityInfos populated with metadata and projection.intLets Lucene sort the results.targetedEntities(List<Class<?>> classes) Defines the targeted entities.timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory) Define the timeout exception factory to customize the exception returned by the user.
-
Constructor Details
-
HSQueryImpl
-
-
Method Details
-
luceneQuery
Description copied from interface:HSQueryDefines the underlying Lucene query- Specified by:
luceneQueryin interfaceHSQuery- Parameters:
query- the Lucene query- Returns:
thisto allow method chaining
-
targetedEntities
Description copied from interface:HSQueryDefines the targeted entities. This helps to reduce the number of targeted indexes.- Specified by:
targetedEntitiesin interfaceHSQuery- Parameters:
classes- the list of classes (indexes) targeted by this query- Returns:
thisto allow for method chaining
-
sort
Description copied from interface:HSQueryLets Lucene sort the results. This is useful when you have different sort requirements than the default Lucene ranking. Without Lucene sorting you would have to retrieve the full result set and order the Hibernate objects. -
filter
Description copied from interface:HSQueryAllows to use lucene filters. Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach -
timeoutExceptionFactory
Description copied from interface:HSQueryDefine the timeout exception factory to customize the exception returned by the user. Defaults to returningQueryTimeoutException- Specified by:
timeoutExceptionFactoryin interfaceHSQuery- Parameters:
exceptionFactory- the timeout exception factory to use- Returns:
thisto allow for method chaining
-
projection
Description copied from interface:HSQueryDefines 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). A projectable field must be stored in the Lucene index and use aTwoWayFieldBridgeUnless 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[]- Specified by:
projectionin interfaceHSQuery- Parameters:
fields- the projected field names- Returns:
thisto allow for method chaining
-
firstResult
Description copied from interface:HSQuerySet the first element to retrieve. If not set, elements will be retrieved beginning from element 0.- Specified by:
firstResultin interfaceHSQuery- Parameters:
firstResult- a element number, numbered from 0- Returns:
thisto allow for method chaining
-
maxResults
Description copied from interface:HSQuerySet the maximum number of elements to retrieve. If not set, there is no limit to the number of elements retrieved.- Specified by:
maxResultsin interfaceHSQuery- Parameters:
maxResults- the maximum number of elements- Returns:
thisin order to allow method chaining
-
getTargetedEntities
List of targeted entities as described by the user- Specified by:
getTargetedEntitiesin interfaceHSQuery- Returns:
- the targeted entity types
-
getIndexedTargetedEntities
Set of indexed entities corresponding to the class hierarchy of the targeted entities- Specified by:
getIndexedTargetedEntitiesin interfaceHSQuery
-
getProjectedFields
- Specified by:
getProjectedFieldsin interfaceHSQuery- Returns:
- the projected field names
-
getTimeoutManager
- Specified by:
getTimeoutManagerin interfaceHSQuery- Returns:
- the timeout manager. Make sure to wrap your HSQuery usage around a
timeoutManager.start()andtimeoutManager.stop().
-
getFacetManager
- Specified by:
getFacetManagerin interfaceHSQuery- Returns:
- return the manager for all faceting related operations
-
getLuceneQuery
- Specified by:
getLuceneQueryin interfaceHSQuery- Returns:
- the underlying Lucene query
-
queryEntityInfos
Description copied from interface:HSQueryExecute the Lucene query and return the list ofEntityInfos populated with metadata and projection.ProjectionConstants.THISif projected is
not populated. It is the responsibility of the object source integration.- Specified by:
queryEntityInfosin interfaceHSQuery- Returns:
- list of
EntityInfos populated with metadata and projection
-
queryDocumentExtractor
DocumentExtractor returns a traverser over the full-text results (EntityInfo) This operation is lazy bound: - the query is executed - results are not retrieved until actually requested DocumentExtractor objects *must* be closed when the results are no longer traversed.- Specified by:
queryDocumentExtractorin interfaceHSQuery- Returns:
- the
DocumentExtractorinstance
-
queryResultSize
public int queryResultSize()- Specified by:
queryResultSizein interfaceHSQuery- Returns:
- the number of hits for this search Caution: The number of results might be slightly different from what the object source returns if the index is not in sync with the store at the time of query.
-
explain
Description copied from interface:HSQueryReturn the LuceneExplanationobject describing the score computation for the matching object/document in the current query -
enableFullTextFilter
Description copied from interface:HSQueryEnable a given filter by its name.- Specified by:
enableFullTextFilterin interfaceHSQuery- Parameters:
name- the name of the filter to enable- Returns:
- Returns a
FullTextFilterobject that allows filter parameter injection
-
disableFullTextFilter
Description copied from interface:HSQueryDisable a given filter by its name.- Specified by:
disableFullTextFilterin interfaceHSQuery- Parameters:
name- the name of the filter to disable.
-
getSearchFactoryImplementor
- Specified by:
getSearchFactoryImplementorin interfaceHSQuery- Returns:
- the
SearchFactoryImplementorinstance
-