public class FullTextQueryImpl extends Object implements FullTextQuery
| 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
|
org.hibernate.search.FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
int |
executeUpdate()
Execute an update or delete statement.
|
org.apache.lucene.search.Explanation |
explain(int documentId)
Return the Lucene
Explanation
object describing the score computation for the matching object/document
in the current query |
org.hibernate.search.query.engine.spi.FacetManager |
getFacetManager() |
int |
getFirstResult()
The position of the first result the query object was set to
retrieve.
|
FlushModeType |
getFlushMode()
Get the flush mode in effect for the query execution.
|
Map<String,Object> |
getHints()
Get the properties and hints and associated values that are
in effect for the query instance.
|
LockModeType |
getLockMode()
Get the current lock mode for the query.
|
int |
getMaxResults()
The maximum number of results the query object was set to
retrieve.
|
Parameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared
positional parameter with the given position.
|
<T> Parameter<T> |
getParameter(int position,
Class<T> type)
Get the parameter object corresponding to the declared
positional parameter with the given position and type.
|
Parameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared
parameter of the given name.
|
<T> Parameter<T> |
getParameter(String name,
Class<T> type)
Get the parameter object corresponding to the declared
parameter of the given name and type.
|
Set<Parameter<?>> |
getParameters()
Get the parameter objects corresponding to the declared
parameters of the query.
|
Object |
getParameterValue(int position)
Return the value bound to the positional parameter.
|
<T> T |
getParameterValue(Parameter<T> param)
Return the value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the value bound to the named parameter.
|
List |
getResultList()
Execute a SELECT query and return the query results
as an untyped List.
|
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()
Execute a SELECT query that returns a single untyped result.
|
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(org.hibernate.search.query.ObjectLookupMethod lookupMethod,
org.hibernate.search.query.DatabaseRetrievalMethod retrievalMethod)
Refine the strategies used to load entities.
|
boolean |
isBound(Parameter<?> param)
Return a boolean indicating whether a value has been bound
to the parameter.
|
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(org.apache.lucene.search.Filter filter)
Allows to use lucene filters.
|
Query |
setFirstResult(int firstResult)
Set the position of the first result to retrieve.
|
Query |
setFlushMode(FlushModeType flushMode)
Set the flush mode type to be used for the query execution.
|
Query |
setHint(String hintName,
Object value)
Set a query property or hint.
|
Query |
setLockMode(LockModeType lockModeType)
Set the lock mode type to be used for the query execution.
|
Query |
setMaxResults(int maxResults)
Set the maximum number of results to retrieve.
|
Query |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
Query |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
Query |
setParameter(int position,
Object value)
Bind an argument to a positional parameter.
|
Query |
setParameter(Parameter<Calendar> calendarParameter,
Calendar calendar,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
Query |
setParameter(Parameter<Date> dateParameter,
Date date,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<T> Query |
setParameter(Parameter<T> tParameter,
T t)
Bind the value of a
Parameter object. |
Query |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
Query |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
Query |
setParameter(String name,
Object value)
Bind an argument to a named parameter.
|
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(org.apache.lucene.search.Sort sort)
Allows to let lucene sort the results.
|
FullTextQuery |
setSpatialParameters(org.hibernate.search.spatial.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)
Return an object of the specified type to allow access to
the provider-specific API.
|
PersistenceException |
wrapLockException(HibernateException e,
LockOptions lockOptions) |
public FullTextQueryImpl(FullTextQuery query, Session session)
public FullTextQuery setSort(org.apache.lucene.search.Sort sort)
FullTextQuerysetSort in interface FullTextQuerysort - The lucene sort object.public FullTextQuery setFilter(org.apache.lucene.search.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(org.hibernate.search.spatial.Coordinates center, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuerycenter - the search centerfieldName - name of the spatial fieldthis for method chainingpublic org.hibernate.search.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()
QuerygetResultList in interface Querypublic org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
getFacetManager in interface FullTextQuerypublic PersistenceException wrapLockException(HibernateException e, LockOptions lockOptions)
public Object getSingleResult()
QuerygetSingleResult in interface Querypublic Query setMaxResults(int maxResults)
QuerysetMaxResults in interface QuerymaxResults - maximum number of results to retrievepublic int getMaxResults()
QueryInteger.MAX_VALUE if setMaxResults was not
applied to the query object.getMaxResults in interface Querypublic Query setFirstResult(int firstResult)
QuerysetFirstResult in interface QueryfirstResult - position of the first result,
numbered from 0public int getFirstResult()
QuerysetFirstResult was not applied to the
query object.getFirstResult in interface Querypublic org.apache.lucene.search.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(org.hibernate.search.query.ObjectLookupMethod lookupMethod, org.hibernate.search.query.DatabaseRetrievalMethod retrievalMethod)
FullTextQueryinitializeObjectsWith in interface FullTextQuerypublic int executeUpdate()
QueryexecuteUpdate in interface Querypublic Query setHint(String hintName, Object value)
Querypublic Map<String,Object> getHints()
Querypublic <T> Query setParameter(Parameter<T> tParameter, T t)
QueryParameter object.setParameter in interface QuerytParameter - parameter objectt - parameter valuepublic Query setParameter(Parameter<Calendar> calendarParameter, Calendar calendar, TemporalType temporalType)
Queryjava.util.Calendar to a Parameter object.setParameter in interface QuerycalendarParameter - parameter objectcalendar - parameter valuetemporalType - temporal typepublic Query setParameter(Parameter<Date> dateParameter, Date date, TemporalType temporalType)
Queryjava.util.Date to a Parameter object.setParameter in interface QuerydateParameter - parameter objectdate - parameter valuetemporalType - temporal typepublic Query setParameter(String name, Object value)
QuerysetParameter in interface Queryname - parameter namevalue - parameter valuepublic Query setParameter(String name, Date value, TemporalType temporalType)
Queryjava.util.Date to a named parameter.setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal typepublic Query setParameter(String name, Calendar value, TemporalType temporalType)
Queryjava.util.Calendar to a named parameter.setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal typepublic Query setParameter(int position, Object value)
QuerysetParameter in interface Queryposition - positionvalue - parameter valuepublic Query setParameter(int position, Date value, TemporalType temporalType)
Queryjava.util.Date to a positional parameter.setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal typepublic Set<Parameter<?>> getParameters()
QuerygetParameters in interface Querypublic Query setParameter(int position, Calendar value, TemporalType temporalType)
Queryjava.util.Calendar to a positional
parameter.setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal typepublic Parameter<?> getParameter(String name)
QuerygetParameter in interface Queryname - parameter namepublic Parameter<?> getParameter(int position)
QuerygetParameter in interface Queryposition - positionpublic <T> Parameter<T> getParameter(String name, Class<T> type)
QuerygetParameter in interface Queryname - parameter nametype - typepublic <T> Parameter<T> getParameter(int position, Class<T> type)
QuerygetParameter in interface Queryposition - positiontype - typepublic boolean isBound(Parameter<?> param)
Querypublic <T> T getParameterValue(Parameter<T> param)
QuerygetParameterValue in interface Queryparam - parameter objectpublic Object getParameterValue(String name)
QuerygetParameterValue in interface Queryname - parameter namepublic Object getParameterValue(int position)
QuerygetParameterValue in interface Queryposition - positionpublic Query setFlushMode(FlushModeType flushMode)
QuerysetFlushMode in interface QueryflushMode - flush modepublic FlushModeType getFlushMode()
QuerygetFlushMode in interface Querypublic Query setLockMode(LockModeType lockModeType)
QuerysetLockMode in interface QuerylockModeType - lock modepublic LockModeType getLockMode()
QuerygetLockMode in interface QueryCopyright © 2018 JBoss by Red Hat. All rights reserved.