org.hibernate.search.jpa.impl
public class FullTextQueryImpl extends Object implements FullTextQuery
DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS| Constructor and Description |
|---|
FullTextQueryImpl(FullTextQuery query,
Session session) |
| Modifier and Type | Method and Description |
|---|---|
void |
disableFullTextFilter(String name)
Disable a given filter by its name
|
FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
int |
executeUpdate() |
Explanation |
explain(int documentId)
Return the Lucene
Explanation
object describing the score computation for the matching object/document
in the current query |
FacetManager |
getFacetManager() |
int |
getFirstResult() |
javax.persistence.FlushModeType |
getFlushMode() |
Map<String,Object> |
getHints() |
javax.persistence.LockModeType |
getLockMode() |
int |
getMaxResults() |
javax.persistence.Parameter<?> |
getParameter(int position) |
<T> javax.persistence.Parameter<T> |
getParameter(int position,
Class<T> type) |
javax.persistence.Parameter<?> |
getParameter(String name) |
<T> javax.persistence.Parameter<T> |
getParameter(String name,
Class<T> type) |
Set<javax.persistence.Parameter<?>> |
getParameters() |
Object |
getParameterValue(int position) |
<T> T |
getParameterValue(javax.persistence.Parameter<T> param) |
Object |
getParameterValue(String name) |
List |
getResultList() |
int |
getResultSize()
Returns the number of hits for this search
Caution:
The number of results might be slightly different from
getResultList().size() because getResultList()
may be not in sync with the database at the time of query. |
Object |
getSingleResult() |
boolean |
hasPartialResults()
*Experimental* API, subject to change or removal
When using
FullTextQuery.limitExecutionTimeTo(long, java.util.concurrent.TimeUnit) }, returns true if partial results are returned (ie if the time limit has been reached
and the result fetching process has been terminated. |
FullTextQuery |
initializeObjectsWith(ObjectLookupMethod lookupMethod,
DatabaseRetrievalMethod retrievalMethod)
Refine the strategies used to load entities.
|
boolean |
isBound(javax.persistence.Parameter<?> param) |
FullTextQuery |
limitExecutionTimeTo(long timeout,
TimeUnit timeUnit)
*Experimental* API, subject to change or removal
Limit the time used by Hibernate Search to execute the query.
|
FullTextQuery |
setCriteriaQuery(Criteria criteria)
Defines the Database Query used to load the Lucene results.
|
FullTextQuery |
setFilter(Filter filter)
Allows to use lucene filters.
|
javax.persistence.Query |
setFirstResult(int firstResult) |
javax.persistence.Query |
setFlushMode(javax.persistence.FlushModeType flushMode) |
javax.persistence.Query |
setHint(String hintName,
Object value) |
javax.persistence.Query |
setLockMode(javax.persistence.LockModeType lockModeType) |
javax.persistence.Query |
setMaxResults(int maxResults) |
javax.persistence.Query |
setParameter(int position,
Calendar value,
javax.persistence.TemporalType temporalType) |
javax.persistence.Query |
setParameter(int position,
Date value,
javax.persistence.TemporalType temporalType) |
javax.persistence.Query |
setParameter(int position,
Object value) |
javax.persistence.Query |
setParameter(javax.persistence.Parameter<Calendar> calendarParameter,
Calendar calendar,
javax.persistence.TemporalType temporalType) |
javax.persistence.Query |
setParameter(javax.persistence.Parameter<Date> dateParameter,
Date date,
javax.persistence.TemporalType temporalType) |
<T> javax.persistence.Query |
setParameter(javax.persistence.Parameter<T> tParameter,
T t) |
javax.persistence.Query |
setParameter(String name,
Calendar value,
javax.persistence.TemporalType temporalType) |
javax.persistence.Query |
setParameter(String name,
Date value,
javax.persistence.TemporalType temporalType) |
javax.persistence.Query |
setParameter(String name,
Object value) |
FullTextQuery |
setProjection(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).
|
FullTextQuery |
setResultTransformer(ResultTransformer transformer)
defines a result transformer used during projection
|
FullTextQuery |
setSort(Sort sort)
Allows to let lucene sort the results.
|
FullTextQuery |
setSpatialParameters(Coordinates center,
String fieldName)
Defines the center of the spatial search for this query to project distance in results
|
FullTextQuery |
setSpatialParameters(double latitude,
double longitude,
String fieldName)
Defines the center of the spatial search for this query to project distance in results
|
<T> T |
unwrap(Class<T> type) |
javax.persistence.PersistenceException |
wrapLockException(HibernateException e,
LockOptions lockOptions) |
public FullTextQueryImpl(FullTextQuery query, Session session)
public FullTextQuery setSort(Sort sort)
FullTextQuerysetSort in interface FullTextQuerysort - The lucene sort object.public FullTextQuery setFilter(Filter filter)
FullTextQuerysetFilter in interface FullTextQueryfilter - The lucene filter.public int getResultSize()
FullTextQuerygetResultList().size() because getResultList()
may be not in sync with the database at the time of query.getResultSize in interface FullTextQuerypublic FullTextQuery setCriteriaQuery(Criteria criteria)
FullTextQuerysetCriteriaQuery in interface FullTextQuerypublic FullTextQuery setProjection(String... fields)
FullTextQueryTwoWayFieldBridge
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[]setProjection in interface FullTextQuerypublic FullTextQuery setSpatialParameters(double latitude, double longitude, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuerylatitude - latitude of the search centerlongitude - longitude of the search centerfieldName - name of the spatial fieldthis for method chainingpublic FullTextQuery setSpatialParameters(Coordinates center, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuerycenter - the search centerfieldName - name of the spatial fieldthis for method chainingpublic FullTextFilter enableFullTextFilter(String name)
FullTextQueryenableFullTextFilter in interface FullTextQuerypublic void disableFullTextFilter(String name)
FullTextQuerydisableFullTextFilter in interface FullTextQuerypublic FullTextQuery setResultTransformer(ResultTransformer transformer)
FullTextQuerysetResultTransformer in interface FullTextQuerypublic List getResultList()
getResultList in interface javax.persistence.Querypublic FacetManager getFacetManager()
getFacetManager in interface FullTextQuerypublic javax.persistence.PersistenceException wrapLockException(HibernateException e, LockOptions lockOptions)
public Object getSingleResult()
getSingleResult in interface javax.persistence.Querypublic javax.persistence.Query setMaxResults(int maxResults)
setMaxResults in interface javax.persistence.Querypublic int getMaxResults()
getMaxResults in interface javax.persistence.Querypublic javax.persistence.Query setFirstResult(int firstResult)
setFirstResult in interface javax.persistence.Querypublic int getFirstResult()
getFirstResult in interface javax.persistence.Querypublic Explanation explain(int documentId)
FullTextQueryExplanation
object describing the score computation for the matching object/document
in the current queryexplain in interface FullTextQuerydocumentId - Lucene Document id to be explain. This is NOT the object idpublic FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQueryFullTextQuery.hasPartialResults() returns true.limitExecutionTimeTo in interface FullTextQuerytimeout - time out periodtimeUnit - time out unitpublic boolean hasPartialResults()
FullTextQueryFullTextQuery.limitExecutionTimeTo(long, java.util.concurrent.TimeUnit) }, returns true if partial results are returned (ie if the time limit has been reached
and the result fetching process has been terminated.hasPartialResults in interface FullTextQuerypublic FullTextQuery initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)
FullTextQueryinitializeObjectsWith in interface FullTextQuerypublic int executeUpdate()
executeUpdate in interface javax.persistence.Querypublic javax.persistence.Query setHint(String hintName, Object value)
setHint in interface javax.persistence.Querypublic Map<String,Object> getHints()
getHints in interface javax.persistence.Querypublic <T> javax.persistence.Query setParameter(javax.persistence.Parameter<T> tParameter,
T t)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(javax.persistence.Parameter<Calendar> calendarParameter, Calendar calendar, javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(javax.persistence.Parameter<Date> dateParameter, Date date, javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(String name, Object value)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(String name, Date value, javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(String name, Calendar value, javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(int position,
Object value)
setParameter in interface javax.persistence.Querypublic javax.persistence.Query setParameter(int position,
Date value,
javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic Set<javax.persistence.Parameter<?>> getParameters()
getParameters in interface javax.persistence.Querypublic javax.persistence.Query setParameter(int position,
Calendar value,
javax.persistence.TemporalType temporalType)
setParameter in interface javax.persistence.Querypublic javax.persistence.Parameter<?> getParameter(String name)
getParameter in interface javax.persistence.Querypublic javax.persistence.Parameter<?> getParameter(int position)
getParameter in interface javax.persistence.Querypublic <T> javax.persistence.Parameter<T> getParameter(String name, Class<T> type)
getParameter in interface javax.persistence.Querypublic <T> javax.persistence.Parameter<T> getParameter(int position,
Class<T> type)
getParameter in interface javax.persistence.Querypublic boolean isBound(javax.persistence.Parameter<?> param)
isBound in interface javax.persistence.Querypublic <T> T getParameterValue(javax.persistence.Parameter<T> param)
getParameterValue in interface javax.persistence.Querypublic Object getParameterValue(String name)
getParameterValue in interface javax.persistence.Querypublic Object getParameterValue(int position)
getParameterValue in interface javax.persistence.Querypublic javax.persistence.Query setFlushMode(javax.persistence.FlushModeType flushMode)
setFlushMode in interface javax.persistence.Querypublic javax.persistence.FlushModeType getFlushMode()
getFlushMode in interface javax.persistence.Querypublic javax.persistence.Query setLockMode(javax.persistence.LockModeType lockModeType)
setLockMode in interface javax.persistence.Querypublic javax.persistence.LockModeType getLockMode()
getLockMode in interface javax.persistence.Querypublic <T> T unwrap(Class<T> type)
unwrap in interface javax.persistence.QueryCopyright © 2006-2015 Red Hat, Inc. All Rights Reserved