public class HSQueryImpl extends Object implements HSQuery, Serializable
DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS
Constructor and Description |
---|
HSQueryImpl(ExtendedSearchIntegrator extendedIntegrator) |
Modifier and Type | Method and Description |
---|---|
void |
afterDeserialise(SearchIntegrator extendedIntegrator)
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.
|
ExtendedSearchIntegrator |
getExtendedSearchIntegrator()
getExtendedSearchIntegrator.
|
FacetManagerImpl |
getFacetManager() |
Set<Class<?>> |
getIndexedTargetedEntities() |
Query |
getLuceneQuery() |
String[] |
getProjectedFields() |
List<Class<?>> |
getTargetedEntities()
List of targeted entities as described by the user
|
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()
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.
|
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 |
tenantIdentifier(String tenantId) |
HSQuery |
timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
Define the timeout exception factory to customize the exception returned by the user.
|
protected void |
validateSortFields(ExtendedSearchIntegrator extendedIntegrator) |
public HSQueryImpl(ExtendedSearchIntegrator extendedIntegrator)
public void afterDeserialise(SearchIntegrator extendedIntegrator)
HSQuery
afterDeserialise.
afterDeserialise
in interface HSQuery
extendedIntegrator
- a SearchIntegrator
object.public HSQuery setSpatialParameters(Coordinates center, String fieldName)
HSQuery
setSpatialParameters.
setSpatialParameters
in interface HSQuery
center
- center of the spatial searchfieldName
- name ot the spatial fieldthis
to allow for method chainingpublic HSQuery tenantIdentifier(String tenantId)
tenantIdentifier
in interface HSQuery
public HSQuery luceneQuery(Query query)
HSQuery
luceneQuery
in interface HSQuery
query
- the Lucene querythis
to allow method chainingpublic HSQuery targetedEntities(List<Class<?>> classes)
HSQuery
targetedEntities
in interface HSQuery
classes
- the list of classes (indexes) targeted by this querythis
to allow for method chainingpublic HSQuery sort(Sort sort)
HSQuery
public HSQuery filter(Filter filter)
HSQuery
public HSQuery timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
HSQuery
QueryTimeoutException
timeoutExceptionFactory
in interface HSQuery
exceptionFactory
- the timeout exception factory to usethis
to allow for method chainingpublic HSQuery projection(String... fields)
HSQuery
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. 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 HSQuery
fields
- the projected field namesthis
to allow for method chainingpublic HSQuery firstResult(int firstResult)
HSQuery
firstResult
in interface HSQuery
firstResult
- a element number, numbered from 0this
to allow for method chainingpublic HSQuery maxResults(int maxResults)
HSQuery
maxResults
in interface HSQuery
maxResults
- the maximum number of elementsthis
in order to allow method chainingpublic List<Class<?>> getTargetedEntities()
getTargetedEntities
in interface HSQuery
public Set<Class<?>> getIndexedTargetedEntities()
getIndexedTargetedEntities
in interface HSQuery
public String[] getProjectedFields()
getProjectedFields
in interface HSQuery
public TimeoutManager getTimeoutManager()
getTimeoutManager
in interface HSQuery
timeoutManager.start()
and timeoutManager.stop()
.public FacetManagerImpl getFacetManager()
getFacetManager
in interface HSQuery
public Query getLuceneQuery()
getLuceneQuery
in interface HSQuery
public List<EntityInfo> queryEntityInfos()
HSQuery
EntityInfo
s populated with
metadata and projection. ProjectionConstants.THIS
if projected is not populated.
It is the responsibility of the object source integration.queryEntityInfos
in interface HSQuery
EntityInfo
s populated with metadata and projectionpublic DocumentExtractor queryDocumentExtractor()
queryDocumentExtractor
in interface HSQuery
DocumentExtractor
instancepublic int queryResultSize()
queryResultSize
in interface HSQuery
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.
public Explanation explain(int documentId)
HSQuery
Explanation
object describing the score computation for the matching object/document
in the current querypublic FullTextFilter enableFullTextFilter(String name)
HSQuery
enableFullTextFilter
in interface HSQuery
name
- the name of the filter to enableFullTextFilter
object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
HSQuery
disableFullTextFilter
in interface HSQuery
name
- the name of the filter to disable.protected void validateSortFields(ExtendedSearchIntegrator extendedIntegrator)
public ExtendedSearchIntegrator getExtendedSearchIntegrator()
HSQuery
getExtendedSearchIntegrator.
getExtendedSearchIntegrator
in interface HSQuery
ExtendedSearchintegrator
instanceCopyright © 2006-2017 Red Hat, Inc. All Rights Reserved