Interface HSQuery
-
- All Superinterfaces:
ProjectionConstants
@Deprecated public interface HSQuery extends ProjectionConstants
Deprecated.This class will be removed without replacement. Use actual API instead.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 = searchIntegrator.createHSQuery(); //configure query object query .luceneQuery( luceneQuery ) .timeoutExceptionFactory( exceptionFactory ) .targetedEntities( Arrays.asList( classes ) ); [...] //start timeout counting query.getTimeoutManager().start(); //query execution and use List<EntityInfo> entityInfos = query.getEntityInfos(); [...] //done with the core of the query query.getTimeoutManager().stop();- Author:
- Emmanuel Bernard
-
-
Field Summary
-
Fields inherited from interface org.hibernate.search.engine.ProjectionConstants
DOCUMENT, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Explanationexplain(Object entityId)Deprecated.Return the LuceneExplanationobject describing the score computation for the matching object/document in the current queryvoidfailAfter(long timeout, TimeUnit timeUnit)Deprecated.List<?>fetch()Deprecated.Execute the Lucene query and return the hits.HSQueryfirstResult(int firstResult)Deprecated.Set the first element to retrieve.FacetManagergetFacetManager()Deprecated.QuerygetLuceneQuery()Deprecated.String[]getProjectedFields()Deprecated.StringgetQueryString()Deprecated.intgetResultSize()Deprecated.Set<Class<?>>getTargetedEntities()Deprecated.booleanhasPartialResults()Deprecated.IntegermaxResults()Deprecated.HSQuerymaxResults(Integer maxResults)Deprecated.Set the maximum number of elements to retrieve.HSQueryprojection(String... fields)Deprecated.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).SearchScroll<?>scroll(int chunkSize)Deprecated.Execute the Lucene query continuously, as aSearchScroll.HSQuerysetSpatialParameters(Coordinates center, String fieldName)Deprecated.setSpatialParameters.HSQuerysort(Sort sort)Deprecated.Lets Lucene sort the results.voidtruncateAfter(long timeout, TimeUnit timeUnit)Deprecated.HSQuerytupleTransformer(TupleTransformer tupleTransformer)Deprecated.
-
-
-
Method Detail
-
sort
HSQuery sort(Sort sort)
Deprecated.Lets 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.- Parameters:
sort- The Lucene sort object.- Returns:
thisto allow for method chaining
-
projection
HSQuery projection(String... fields)
Deprecated.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).A projectable field must be stored in the Lucene index and use a two-way field bridge 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[]
- Parameters:
fields- the projected field names- Returns:
thisto allow for method chaining
-
firstResult
HSQuery firstResult(int firstResult)
Deprecated.Set the first element to retrieve. If not set, elements will be retrieved beginning from element0.- Parameters:
firstResult- a element number, numbered from0- Returns:
thisto allow for method chaining
-
maxResults
HSQuery maxResults(Integer maxResults)
Deprecated.Set the maximum number of elements to retrieve. If not set, there is no limit to the number of elements retrieved.- Parameters:
maxResults- the maximum number of elements- Returns:
thisin order to allow method chaining
-
maxResults
Integer maxResults()
Deprecated.- Returns:
- The last value passed to
maxResults(Integer), ornull.
-
getTargetedEntities
Set<Class<?>> getTargetedEntities()
Deprecated.- Returns:
- the targeted entity types
-
getProjectedFields
String[] getProjectedFields()
Deprecated.- Returns:
- the projected field names
-
failAfter
void failAfter(long timeout, TimeUnit timeUnit)Deprecated.- Parameters:
timeout- Timeout value.timeUnit- Timeout unit.- See Also:
SearchQueryOptionsStep.failAfter(long, TimeUnit)
-
truncateAfter
void truncateAfter(long timeout, TimeUnit timeUnit)Deprecated.- Parameters:
timeout- Timeout value.timeUnit- Timeout unit.- See Also:
SearchQueryOptionsStep.truncateAfter(long, TimeUnit)
-
getFacetManager
FacetManager getFacetManager()
Deprecated.- Returns:
- return the manager for all faceting related operations
-
getLuceneQuery
Query getLuceneQuery()
Deprecated.- Returns:
- the underlying Lucene query (if any)
-
getQueryString
String getQueryString()
Deprecated.- Returns:
- a String representation of the underlying query
-
fetch
List<?> fetch()
Deprecated.Execute the Lucene query and return the hits.- Returns:
- list of hits.
-
hasPartialResults
boolean hasPartialResults()
Deprecated.
-
getResultSize
int getResultSize()
Deprecated.- 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.
-
scroll
SearchScroll<?> scroll(int chunkSize)
Deprecated.Execute the Lucene query continuously, as aSearchScroll.- Parameters:
chunkSize- The size of chunks.- Returns:
- the scroll (must eventually be closed).
-
explain
Explanation explain(Object entityId)
Deprecated.Return the LuceneExplanationobject describing the score computation for the matching object/document in the current query- Parameters:
entityId- The identifier of the entity whose match should be explained.- Returns:
- Lucene Explanation
-
setSpatialParameters
HSQuery setSpatialParameters(Coordinates center, String fieldName)
Deprecated.setSpatialParameters.
- Parameters:
center- center of the spatial searchfieldName- name ot the spatial field- Returns:
thisto allow for method chaining
-
tupleTransformer
HSQuery tupleTransformer(TupleTransformer tupleTransformer)
Deprecated.
-
-