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)
FullTextQuery
setSort
in interface FullTextQuery
sort
- The lucene sort object.public FullTextQuery setFilter(org.apache.lucene.search.Filter filter)
FullTextQuery
setFilter
in interface FullTextQuery
filter
- The lucene filter.public int getResultSize()
FullTextQuery
getResultList().size()
because getResultList()
may be not in sync with the database at the time of query.getResultSize
in interface FullTextQuery
public FullTextQuery setCriteriaQuery(Criteria criteria)
FullTextQuery
setCriteriaQuery
in interface FullTextQuery
public FullTextQuery setProjection(String... fields)
FullTextQuery
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[]setProjection
in interface FullTextQuery
public FullTextQuery setSpatialParameters(double latitude, double longitude, String fieldName)
FullTextQuery
setSpatialParameters
in interface FullTextQuery
latitude
- 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)
FullTextQuery
setSpatialParameters
in interface FullTextQuery
center
- the search centerfieldName
- name of the spatial fieldthis
for method chainingpublic org.hibernate.search.FullTextFilter enableFullTextFilter(String name)
FullTextQuery
enableFullTextFilter
in interface FullTextQuery
public void disableFullTextFilter(String name)
FullTextQuery
disableFullTextFilter
in interface FullTextQuery
public FullTextQuery setResultTransformer(ResultTransformer transformer)
FullTextQuery
setResultTransformer
in interface FullTextQuery
public List getResultList()
Query
getResultList
in interface Query
public org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
getFacetManager
in interface FullTextQuery
public PersistenceException wrapLockException(HibernateException e, LockOptions lockOptions)
public Object getSingleResult()
Query
getSingleResult
in interface Query
public Query setMaxResults(int maxResults)
Query
setMaxResults
in interface Query
maxResults
- maximum number of results to retrievepublic int getMaxResults()
Query
Integer.MAX_VALUE
if setMaxResults
was not
applied to the query object.getMaxResults
in interface Query
public Query setFirstResult(int firstResult)
Query
setFirstResult
in interface Query
firstResult
- position of the first result,
numbered from 0public int getFirstResult()
Query
setFirstResult
was not applied to the
query object.getFirstResult
in interface Query
public org.apache.lucene.search.Explanation explain(int documentId)
FullTextQuery
Explanation
object describing the score computation for the matching object/document
in the current queryexplain
in interface FullTextQuery
documentId
- Lucene Document id to be explain. This is NOT the object idpublic FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQuery
FullTextQuery.hasPartialResults()
returns true.limitExecutionTimeTo
in interface FullTextQuery
timeout
- time out periodtimeUnit
- time out unitpublic boolean hasPartialResults()
FullTextQuery
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.hasPartialResults
in interface FullTextQuery
public FullTextQuery initializeObjectsWith(org.hibernate.search.query.ObjectLookupMethod lookupMethod, org.hibernate.search.query.DatabaseRetrievalMethod retrievalMethod)
FullTextQuery
initializeObjectsWith
in interface FullTextQuery
public int executeUpdate()
Query
executeUpdate
in interface Query
public Query setHint(String hintName, Object value)
Query
public Map<String,Object> getHints()
Query
public <T> Query setParameter(Parameter<T> tParameter, T t)
Query
Parameter
object.setParameter
in interface Query
tParameter
- parameter objectt
- parameter valuepublic Query setParameter(Parameter<Calendar> calendarParameter, Calendar calendar, TemporalType temporalType)
Query
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
calendarParameter
- parameter objectcalendar
- parameter valuetemporalType
- temporal typepublic Query setParameter(Parameter<Date> dateParameter, Date date, TemporalType temporalType)
Query
java.util.Date
to a Parameter
object.setParameter
in interface Query
dateParameter
- parameter objectdate
- parameter valuetemporalType
- temporal typepublic Query setParameter(String name, Object value)
Query
setParameter
in interface Query
name
- parameter namevalue
- parameter valuepublic Query setParameter(String name, Date value, TemporalType temporalType)
Query
java.util.Date
to a named parameter.setParameter
in interface Query
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic Query setParameter(String name, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a named parameter.setParameter
in interface Query
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic Query setParameter(int position, Object value)
Query
setParameter
in interface Query
position
- positionvalue
- parameter valuepublic Query setParameter(int position, Date value, TemporalType temporalType)
Query
java.util.Date
to a positional parameter.setParameter
in interface Query
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic Set<Parameter<?>> getParameters()
Query
getParameters
in interface Query
public Query setParameter(int position, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic Parameter<?> getParameter(String name)
Query
getParameter
in interface Query
name
- parameter namepublic Parameter<?> getParameter(int position)
Query
getParameter
in interface Query
position
- positionpublic <T> Parameter<T> getParameter(String name, Class<T> type)
Query
getParameter
in interface Query
name
- parameter nametype
- typepublic <T> Parameter<T> getParameter(int position, Class<T> type)
Query
getParameter
in interface Query
position
- positiontype
- typepublic boolean isBound(Parameter<?> param)
Query
public <T> T getParameterValue(Parameter<T> param)
Query
getParameterValue
in interface Query
param
- parameter objectpublic Object getParameterValue(String name)
Query
getParameterValue
in interface Query
name
- parameter namepublic Object getParameterValue(int position)
Query
getParameterValue
in interface Query
position
- positionpublic Query setFlushMode(FlushModeType flushMode)
Query
setFlushMode
in interface Query
flushMode
- flush modepublic FlushModeType getFlushMode()
Query
getFlushMode
in interface Query
public Query setLockMode(LockModeType lockModeType)
Query
setLockMode
in interface Query
lockModeType
- lock modepublic LockModeType getLockMode()
Query
getLockMode
in interface Query
Copyright © 2018 JBoss by Red Hat. All rights reserved.