Package org.hibernate.search.jpa
Interface FullTextQuery
-
- All Superinterfaces:
ProjectionConstants,javax.persistence.Query
- All Known Subinterfaces:
FullTextQuery
@Deprecated public interface FullTextQuery extends javax.persistence.Query, ProjectionConstants
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), then create aSearchQuerywithSearchSession.search(Class). If you really need an adapter to JPA'sQuery, convert thatSearchQueryusingSearch.toJpaQuery(SearchQuery), but be aware that only part of the contract is implemented. Refer to the migration guide for more information.The base interface for full-text queries using the JPA API (Query).- Author:
- Hardy Ferentschik, 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.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), convert it to aLuceneSearchQueryby passingLuceneExtension.get()toSearchQuery.extension(SearchQueryExtension), and get the explanation usingLuceneSearchQuery.explain(Object).FacetManagergetFacetManager()Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your facets (now called aggregations) usingSearchQueryOptionsStep.aggregation(AggregationKey, Function).intgetResultSize()Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and get the total hit count ("result size") usingSearchFetchable.fetchTotalHitCount().booleanhasPartialResults()Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), set a "truncation" timeout usingSearchQueryOptionsStep.truncateAfter(long, TimeUnit), and get theSearchResultwithSearchFetchable.fetch(Integer).FullTextQueryinitializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your loading options usingSearchQueryOptionsStep.loading(Consumer).FullTextQuerylimitExecutionTimeTo(long timeout, TimeUnit timeUnit)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), set a "truncation" timeout usingSearchQueryOptionsStep.truncateAfter(long, TimeUnit), and get theSearchResultwithSearchFetchable.fetch(Integer).FullTextQuerysetFirstResult(int var1)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and pass the hit offset ("firstResult") when fetching results usingSearchFetchable.fetch(Integer),SearchFetchable.fetch(Integer, Integer),SearchFetchable.fetchHits(Integer)orSearchFetchable.fetch(Integer, Integer).FullTextQuerysetFlushMode(javax.persistence.FlushModeType flushMode)Deprecated.FullTextQuerysetHint(String hintName, Object value)Deprecated.FullTextQuerysetMaxResults(int maxResult)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and pass the hit limit ("maxResults") when fetching results usingSearchFetchable.fetch(Integer),SearchFetchable.fetch(Integer, Integer),SearchFetchable.fetchHits(Integer)orSearchFetchable.fetch(Integer, Integer).FullTextQuerysetProjection(String... fields)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function).FullTextQuerysetResultTransformer(org.hibernate.transform.ResultTransformer transformer)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function).FullTextQuerysetSort(Sort sort)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your sorts usingSearchQueryOptionsStep.sort(Function).FullTextQuerysetSpatialParameters(double latitude, double longitude, String fieldName)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function).FullTextQuerysetSpatialParameters(Coordinates center, String fieldName)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function).FullTextQuerysetTimeout(long timeout, TimeUnit timeUnit)Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and set a "failure" timeout usingSearchQueryOptionsStep.failAfter(long, TimeUnit).-
Methods inherited from interface javax.persistence.Query
executeUpdate, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, getResultList, getResultStream, getSingleResult, isBound, setLockMode, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, unwrap
-
-
-
-
Method Detail
-
setSort
@Deprecated FullTextQuery setSort(Sort sort)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your sorts usingSearchQueryOptionsStep.sort(Function). Refer to the migration guide for more information.Allows to let lucene sort the results. This is useful when you have additional sort requirements on top of 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:
- this for method chaining
-
getResultSize
@Deprecated int getResultSize()
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and get the total hit count ("result size") usingSearchFetchable.fetchTotalHitCount(). Refer to the migration guide for more information.Returns the number of hits for this search Caution: The number of results might be slightly different fromgetResultList().size()because getResultList() may be not in sync with the database at the time of query.- Returns:
- the number of hits for this search
-
setProjection
@Deprecated FullTextQuery setProjection(String... fields)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function). Refer to the migration guide for more information.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 fields to use for projection- Returns:
thisfor method chaining
-
setSpatialParameters
@Deprecated FullTextQuery setSpatialParameters(double latitude, double longitude, String fieldName)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function). See in particular the distance projection:SearchProjectionFactory.distance(String, GeoPoint). Refer to the migration guide for more information.Defines the center of the spatial search for this query to project distance in results- Parameters:
latitude- latitude of the search centerlongitude- longitude of the search centerfieldName- name of the spatial field- Returns:
thisfor method chaining
-
setSpatialParameters
@Deprecated FullTextQuery setSpatialParameters(Coordinates center, String fieldName)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function). See in particular the distance projection:SearchProjectionFactory.distance(String, GeoPoint). Refer to the migration guide for more information.Defines the center of the spatial search for this query to project distance in results- Parameters:
center- the search centerfieldName- name of the spatial field- Returns:
thisfor method chaining
-
getFacetManager
@Deprecated FacetManager getFacetManager()
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your facets (now called aggregations) usingSearchQueryOptionsStep.aggregation(AggregationKey, Function). You can then fetch the query result usingSearchFetchable.fetch(Integer)and get each aggregation usingSearchResult.aggregation(AggregationKey). Refer to the migration guide for more information.- Returns:
- return the manager for all faceting related operations
-
setResultTransformer
@Deprecated FullTextQuery setResultTransformer(org.hibernate.transform.ResultTransformer transformer)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your projections usingSearchQuerySelectStep.select(Function). See in particular the composite projection, which allows applying a function to another projection:SearchProjectionFactory.composite(Function, ProjectionFinalStep). Refer to the migration guide for more information.Defines a result transformer used during projection- Parameters:
transformer- theResultTransformerto use during projection- Returns:
thisfor method chaining
-
explain
@Deprecated Explanation explain(Object entityId)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), convert it to aLuceneSearchQueryby passingLuceneExtension.get()toSearchQuery.extension(SearchQueryExtension), and get the explanation usingLuceneSearchQuery.explain(Object). Note theexplainmethods now expect an entity ID, not the internal Lucene docId. Refer to the migration guide for more information.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
-
limitExecutionTimeTo
FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), set a "truncation" timeout usingSearchQueryOptionsStep.truncateAfter(long, TimeUnit), and get theSearchResultwithSearchFetchable.fetch(Integer). You'll be able to check whether the result is partial or not usingSearchResult.timedOut(). Refer to the migration guide for more information.Limit the time used by Hibernate Search to execute the query. When the limit is reached, results already fetched are returned. This time limit is a best effort. The query will likely run for longer than the provided time. The time limit only applies to the interactions between Hibernate Search and Lucene. In other words, a query to the database will not be limited. If the limit is reached and all results are not yet fetched,hasPartialResults()returns true.- Parameters:
timeout- time out periodtimeUnit- time out unit- Returns:
thisfor method chaining
-
hasPartialResults
@Deprecated boolean hasPartialResults()
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), set a "truncation" timeout usingSearchQueryOptionsStep.truncateAfter(long, TimeUnit), and get theSearchResultwithSearchFetchable.fetch(Integer). You'll be able to check whether the result is partial or not usingSearchResult.timedOut(). Refer to the migration guide for more information.- Returns:
- When using
limitExecutionTimeTo(long, java.util.concurrent.TimeUnit)}, returnstrueif partial results are returned (ie if the time limit has been reached and the result fetching process has been terminated.
-
initializeObjectsWith
FullTextQuery initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and define your loading options usingSearchQueryOptionsStep.loading(Consumer). To set the equivalent toObjectLookupMethodin Hibernate Search 6, useSearchLoadingOptionsStep.cacheLookupStrategy(EntityLoadingCacheLookupStrategy). Refer to the migration guide for more information.Refine the strategies used to load entities. The lookup method defines whether or not to lookup first in the second level cache or the persistence context before trying to initialize objects from the database. Defaults to SKIP. The database retrieval method defines how objects are loaded from the database. Defaults to QUERY. Note that Hibernate Search can deviate from these choices when it makes sense.- Parameters:
lookupMethod- lookup methodretrievalMethod- how to initilize an object- Returns:
thisfor method chaining
-
setMaxResults
FullTextQuery setMaxResults(int maxResult)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and pass the hit limit ("maxResults") when fetching results usingSearchFetchable.fetch(Integer),SearchFetchable.fetch(Integer, Integer),SearchFetchable.fetchHits(Integer)orSearchFetchable.fetch(Integer, Integer).- Specified by:
setMaxResultsin interfacejavax.persistence.Query
-
setFirstResult
FullTextQuery setFirstResult(int var1)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and pass the hit offset ("firstResult") when fetching results usingSearchFetchable.fetch(Integer),SearchFetchable.fetch(Integer, Integer),SearchFetchable.fetchHits(Integer)orSearchFetchable.fetch(Integer, Integer).- Specified by:
setFirstResultin interfacejavax.persistence.Query
-
setHint
FullTextQuery setHint(String hintName, Object value)
Deprecated.- Specified by:
setHintin interfacejavax.persistence.Query
-
setFlushMode
FullTextQuery setFlushMode(javax.persistence.FlushModeType flushMode)
Deprecated.- Specified by:
setFlushModein interfacejavax.persistence.Query
-
setTimeout
@Deprecated FullTextQuery setTimeout(long timeout, TimeUnit timeUnit)
Deprecated.Instead of using Hibernate Search 5 APIs, get aSearchSessionusingSearch.session(EntityManager), create a search query withSearchSession.search(Class), and set a "failure" timeout usingSearchQueryOptionsStep.failAfter(long, TimeUnit). Refer to the migration guide for more information.Define a timeout period for a given unit of time. Note that this is time out is on a best effort basis. When the query goes beyond the timeout, aQueryTimeoutExceptionis raised.- Parameters:
timeout- time out periodtimeUnit- time out unit- Returns:
thisto allow method chaining
-
-