public abstract class AbstractHSQuery extends Object implements HSQuery, Serializable
HSQuery implementations, exposing basic state needed by all implementations.| Modifier and Type | Field and Description |
|---|---|
protected ExtendedSearchIntegrator |
extendedIntegrator |
protected Map<String,FullTextFilterImpl> |
filterDefinitions
The map of currently active/enabled filters.
|
protected int |
firstResult |
protected boolean |
hasThisProjection |
static String |
HSEARCH_PROJECTION_FIELD_PREFIX
Common prefix shared by all defined projection constants.
|
protected IndexedTypeSet |
indexedTargetedEntities |
protected Integer |
maxResults |
protected String[] |
projectedFields |
protected org.apache.lucene.search.Sort |
sort |
protected String |
spatialFieldName |
protected Coordinates |
spatialSearchCenter |
protected IndexedTypeSet |
targetedEntities |
protected String |
tenantId |
protected TimeoutExceptionFactory |
timeoutExceptionFactory |
protected TimeoutManagerImpl |
timeoutManager |
protected org.apache.lucene.search.Filter |
userFilter
User specified filters.
|
DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS| Constructor and Description |
|---|
AbstractHSQuery(ExtendedSearchIntegrator extendedIntegrator,
IndexedTypeMap<CustomTypeMetadata> types) |
AbstractHSQuery(ExtendedSearchIntegrator extendedIntegrator,
IndexedTypeSet types) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterDeserialise(SearchIntegrator extendedIntegrator)
afterDeserialise.
|
protected Map<FacetingRequest,FacetMetadata> |
buildFacetingRequestsAndMetadata(Collection<FacetingRequest> facetingRequests,
Iterable<EntityIndexBinding> targetedEntityBindings) |
protected Map<String,EntityIndexBinding> |
buildTargetedEntityIndexBindingsByName() |
protected abstract TimeoutManagerImpl |
buildTimeoutManager() |
protected abstract void |
clearCachedResults() |
protected Object |
createFilterInstance(FullTextFilterImpl fullTextFilter,
FilterDef def) |
void |
disableFullTextFilter(String name)
Disable a given filter by its name.
|
FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
protected abstract void |
extractFacetResults() |
HSQuery |
filter(org.apache.lucene.search.Filter filter)
Deprecated.
|
HSQuery |
firstResult(int firstResult)
Set the first element to retrieve.
|
protected Optional<CustomTypeMetadata> |
getCustomTypeMetadata(IndexedTypeIdentifier target) |
ExtendedSearchIntegrator |
getExtendedSearchIntegrator()
getExtendedSearchIntegrator.
|
IndexedTypeSet |
getIndexedTargetedEntities()
Set of indexed entities corresponding to the class hierarchy of the targeted entities
|
protected Set<IndexManager> |
getIndexManagers(EntityIndexBinding binding) |
String[] |
getProjectedFields() |
protected abstract Set<String> |
getSupportedProjectionConstants() |
IndexedTypeSet |
getTargetedEntities()
List of targeted entities as described by the user
|
TimeoutManagerImpl |
getTimeoutManager() |
boolean |
hasThisProjection() |
protected boolean |
isPreQueryFilterOnly(FilterDef def) |
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).
|
HSQuery |
setSpatialParameters(Coordinates center,
String fieldName)
setSpatialParameters.
|
HSQuery |
sort(org.apache.lucene.search.Sort sort)
Lets Lucene sort the results.
|
HSQuery |
tenantIdentifier(String tenantId) |
HSQuery |
timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
Define the timeout exception factory to customize the exception returned by the user.
|
protected void |
validateSortFields(Iterable<EntityIndexBinding> targetedBindings) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexplain, getFacetManager, getLuceneQuery, getQueryString, luceneQuery, queryDocumentExtractor, queryEntityInfos, queryResultSizepublic static final String HSEARCH_PROJECTION_FIELD_PREFIX
protected transient ExtendedSearchIntegrator extendedIntegrator
protected transient TimeoutExceptionFactory timeoutExceptionFactory
protected transient TimeoutManagerImpl timeoutManager
protected final IndexedTypeSet targetedEntities
protected final IndexedTypeSet indexedTargetedEntities
protected org.apache.lucene.search.Sort sort
protected String tenantId
protected String[] projectedFields
protected boolean hasThisProjection
protected int firstResult
protected Integer maxResults
protected Coordinates spatialSearchCenter
protected String spatialFieldName
protected org.apache.lucene.search.Filter userFilter
filter(org.apache.lucene.search.Filter).protected final Map<String,FullTextFilterImpl> filterDefinitions
public AbstractHSQuery(ExtendedSearchIntegrator extendedIntegrator, IndexedTypeSet types)
public AbstractHSQuery(ExtendedSearchIntegrator extendedIntegrator, IndexedTypeMap<CustomTypeMetadata> types)
public void afterDeserialise(SearchIntegrator extendedIntegrator)
HSQueryafterDeserialise.
afterDeserialise in interface HSQueryextendedIntegrator - a SearchIntegrator object.public HSQuery setSpatialParameters(Coordinates center, String fieldName)
HSQuerysetSpatialParameters.
setSpatialParameters in interface HSQuerycenter - center of the spatial searchfieldName - name ot the spatial fieldthis to allow for method chainingpublic HSQuery tenantIdentifier(String tenantId)
tenantIdentifier in interface HSQueryprotected final Optional<CustomTypeMetadata> getCustomTypeMetadata(IndexedTypeIdentifier target)
public HSQuery sort(org.apache.lucene.search.Sort sort)
HSQuery@Deprecated public HSQuery filter(org.apache.lucene.search.Filter filter)
HSQuerypublic HSQuery timeoutExceptionFactory(TimeoutExceptionFactory exceptionFactory)
HSQueryQueryTimeoutExceptiontimeoutExceptionFactory in interface HSQueryexceptionFactory - 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 HSQueryfields - the projected field namesthis to allow for method chainingpublic HSQuery firstResult(int firstResult)
HSQueryfirstResult in interface HSQueryfirstResult - a element number, numbered from 0this to allow for method chainingpublic HSQuery maxResults(int maxResults)
HSQuerymaxResults in interface HSQuerymaxResults - the maximum number of elementsthis in order to allow method chainingpublic FullTextFilter enableFullTextFilter(String name)
HSQueryenableFullTextFilter in interface HSQueryname - the name of the filter to enableFullTextFilter object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
HSQuerydisableFullTextFilter in interface HSQueryname - the name of the filter to disable.protected Object createFilterInstance(FullTextFilterImpl fullTextFilter, FilterDef def)
protected boolean isPreQueryFilterOnly(FilterDef def)
public IndexedTypeSet getTargetedEntities()
getTargetedEntities in interface HSQuerypublic IndexedTypeSet getIndexedTargetedEntities()
getIndexedTargetedEntities in interface HSQuerypublic String[] getProjectedFields()
getProjectedFields in interface HSQuerypublic boolean hasThisProjection()
hasThisProjection in interface HSQuerytrue if the projected field names contain the
ProjectionConstants.THIS constant.public TimeoutManagerImpl getTimeoutManager()
getTimeoutManager in interface HSQuerytimeoutManager.start() and timeoutManager.stop().public ExtendedSearchIntegrator getExtendedSearchIntegrator()
HSQuerygetExtendedSearchIntegrator.
getExtendedSearchIntegrator in interface HSQueryExtendedSearchIntegrator instanceprotected abstract Set<String> getSupportedProjectionConstants()
HSEARCH_PROJECTION_FIELD_PREFIX and is not
part of the set of constants returned by an implementation, an exception will be raised.protected void validateSortFields(Iterable<EntityIndexBinding> targetedBindings)
protected final Map<String,EntityIndexBinding> buildTargetedEntityIndexBindingsByName()
protected final Map<FacetingRequest,FacetMetadata> buildFacetingRequestsAndMetadata(Collection<FacetingRequest> facetingRequests, Iterable<EntityIndexBinding> targetedEntityBindings)
protected Set<IndexManager> getIndexManagers(EntityIndexBinding binding)
protected abstract void extractFacetResults()
protected abstract void clearCachedResults()
protected abstract TimeoutManagerImpl buildTimeoutManager()
Copyright © 2006–2017 Hibernate. All rights reserved.