public class FullTextQueryImpl extends AbstractProducedQuery implements FullTextQuery
FullTextQuery
.Constructor and Description |
---|
FullTextQueryImpl(org.hibernate.search.query.engine.spi.HSQuery hSearchQuery,
SessionImplementor session,
ParameterMetadata parameterMetadata)
Constructs a
FullTextQueryImpl instance. |
Modifier and Type | Method and Description |
---|---|
void |
disableFullTextFilter(String name)
Disable a given filter by its name
|
int |
doGetResultSize() |
protected List |
doHibernateSearchList() |
org.hibernate.search.filter.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.
|
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.
|
protected Map |
getLockModes() |
LockOptions |
getLockOptions()
Obtains the LockOptions in effect for this query.
|
int |
getMaxResults()
The maximum number of results the query object was set to
retrieve.
|
QueryParameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared
positional parameter with the given position.
|
QueryParameter |
getParameter(int position,
Class type)
Get the parameter object corresponding to the declared
positional parameter with the given position and type.
|
QueryParameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared
parameter of the given name.
|
QueryParameter |
getParameter(String name,
Class 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 input value bound to the positional parameter.
|
Object |
getParameterValue(Parameter param)
Return the input value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the input value bound to the named parameter.
|
protected QueryParameterBindings |
getQueryParameterBindings() |
String |
getQueryString()
Get the query string.
|
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. |
String[] |
getReturnAliases()
Deprecated.
|
Type[] |
getReturnTypes()
Deprecated.
|
boolean |
hasPartialResults() |
FullTextQueryImpl |
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.
|
protected boolean |
isNativeQuery()
Is the query represented here a native (SQL) query?
|
Iterator |
iterate()
Return an iterator on the results.
|
FullTextQueryImpl |
limitExecutionTimeTo(long timeout,
TimeUnit timeUnit)
Limit the time used by Hibernate Search to execute the query.
|
List |
list()
Return the query results as a List.
|
ScrollableResultsImpl |
scroll()
Return the query results as ScrollableResults.
|
ScrollableResultsImplementor |
scroll(ScrollMode scrollMode)
Return the query results as ScrollableResults.
|
FullTextQueryImpl |
setCriteriaQuery(Criteria criteria)
Defines the Database Query used to load the Lucene results.
|
FullTextQueryImpl |
setEntity(int position,
Object val)
Deprecated.
|
FullTextQueryImpl |
setEntity(String name,
Object val)
Deprecated.
|
FullTextQueryImpl |
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.
|
FullTextQueryImpl |
setFilter(org.apache.lucene.search.Filter filter)
Deprecated.
|
FullTextQuery |
setFirstResult(int firstResult)
Set the position of the first result to retrieve.
|
FullTextQueryImpl |
setFlushMode(FlushModeType flushModeType)
Set the flush mode type to be used for the query execution.
|
FullTextQuery |
setHint(String hintName,
Object value)
Set a query property or hint.
|
FullTextQueryImpl |
setLockMode(LockModeType lockModeType)
Set the lock mode type to be used for the query execution.
|
QueryImplementor |
setLockMode(String alias,
LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).
|
QueryImplementor |
setLockOptions(LockOptions lockOptions)
Set the lock options for the query.
|
FullTextQuery |
setMaxResults(int maxResults)
Set the maximum number of results to retrieve.
|
FullTextQueryImpl |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
FullTextQueryImpl |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
FullTextQueryImpl |
setParameter(int position,
Object value)
Bind an argument value to a positional parameter.
|
FullTextQueryImpl |
setParameter(Parameter calendarParameter,
Calendar calendar,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
FullTextQueryImpl |
setParameter(Parameter dateParameter,
Date date,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
FullTextQueryImpl |
setParameter(Parameter tParameter,
Object t)
Bind the value of a
Parameter object. |
FullTextQueryImpl |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
FullTextQueryImpl |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
FullTextQueryImpl |
setParameter(String name,
Object value)
Bind an argument value to a named parameter.
|
FullTextQueryImpl |
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).
|
FullTextQueryImpl |
setResultTransformer(ResultTransformer transformer)
Deprecated.
|
FullTextQueryImpl |
setSort(org.apache.lucene.search.Sort sort)
Allows to let lucene sort the results.
|
FullTextQueryImpl |
setSpatialParameters(org.hibernate.search.spatial.Coordinates center,
String fieldName)
Defines the center of the spatial search for this query to project distance in results
|
FullTextQueryImpl |
setSpatialParameters(double latitude,
double longitude,
String fieldName)
Defines the center of the spatial search for this query to project distance in results
|
FullTextQueryImpl |
setTimeout(int timeout)
Set the query timeout in seconds.
|
FullTextQueryImpl |
setTimeout(long timeout,
TimeUnit timeUnit)
Define a timeout period for a given unit of time.
|
String |
toString() |
Object |
unwrap(Class type)
Return an object of the specified type to allow access to
the provider-specific API.
|
addQueryHint, afterQuery, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyEntityGraphQueryHint, applyFetchSizeHint, applyFlushModeHint, applyFollowOnLockingHint, applyHibernateLockModeHint, applyJpaCacheRetrieveMode, applyJpaCacheStoreMode, applyLockModeTypeHint, applyLockTimeoutHint, applyNativeQueryLockMode, applyPassDistinctThrough, applyReadOnlyHint, applyTimeoutHint, beforeQuery, canApplyAliasSpecificLockModeHints, collectBaselineHints, collectHints, determineProperBooleanType, determineProperBooleanType, determineType, doExecuteUpdate, doIterate, doList, doScroll, getCacheMode, getCacheRegion, getComment, getExceptionConverter, getFetchSize, getFlushMode, getHibernateFlushMode, getNamedParameterMap, getNamedParameters, getParameterMetadata, getPositionalParameterTypes, getPositionalParameterValues, getProducer, getQueryOptions, getQueryParameters, getSingleResult, getSupportedHints, getTimeout, handleUnrecognizedHint, isCacheable, isCallable, isReadOnly, makeQueryParametersForExecution, putIfNotNull, putIfNotNull, resolveEntityName, setCacheable, setCacheMode, setCacheRegion, setComment, setFlushMode, setHibernateFlushMode, setOptionalEntityName, setOptionalId, setOptionalObject, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setProperties, setProperties, setReadOnly, stream, uniqueElement, uniqueResult, uniqueResultOptional
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProducer, setOptionalEntityName, setOptionalId, setOptionalObject
addQueryHint, getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getParameterMetadata, getResultStream, getSingleResult, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setComment, setDate, setDate, setDouble, setDouble, setFloat, setFloat, setFlushMode, setHibernateFlushMode, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setReadOnly, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp, stream, uniqueResult, uniqueResultOptional
determineProperBooleanType, determineProperBooleanType, getFlushMode, getHibernateFirstResult, getHibernateMaxResults, getNamedParameters, getQueryOptions, getTimeout, isCacheable, isReadOnly, setHibernateFirstResult, setHibernateMaxResults, setParameterList, setParameterList, setParameterList, setParameterList
public FullTextQueryImpl(org.hibernate.search.query.engine.spi.HSQuery hSearchQuery, SessionImplementor session, ParameterMetadata parameterMetadata)
FullTextQueryImpl
instance.hSearchQuery
- The querysession
- Access to the Hibernate session.parameterMetadata
- Additional query metadata.public FullTextQueryImpl setSort(org.apache.lucene.search.Sort sort)
FullTextQuery
setSort
in interface FullTextQuery
sort
- The lucene sort object.@Deprecated public FullTextQueryImpl setFilter(org.apache.lucene.search.Filter filter)
FullTextQuery
setFilter
in interface FullTextQuery
filter
- The Lucene filter.Filter
public List getResultList()
Query
getResultList
in interface Query
getResultList
in interface TypedQuery
public Iterator iterate()
iterate
in class AbstractProducedQuery
public ScrollableResultsImpl scroll()
Query
You should call ScrollableResults.close()
after processing the ScrollableResults
so that the underlying resources are deallocated right away.
scroll
in class AbstractProducedQuery
ScrollableResults
public ScrollableResultsImplementor scroll(ScrollMode scrollMode)
Query
You should call ScrollableResults.close()
after processing the ScrollableResults
so that the underlying resources are deallocated right away.
scroll
in class AbstractProducedQuery
scrollMode
- The scroll modeScrollableResults
,
ScrollMode
public List list()
Query
list
in class AbstractProducedQuery
protected List doHibernateSearchList()
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 idExplanation
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 int doGetResultSize()
public FullTextQueryImpl setCriteriaQuery(Criteria criteria)
FullTextQuery
setCriteriaQuery
in interface FullTextQuery
criteria
- a query defined using Criteria
this
for method chainingpublic FullTextQueryImpl 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
fields
- the fields to use for projectionthis
for method chainingpublic FullTextQueryImpl 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 FullTextQueryImpl 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 setMaxResults(int maxResults)
TypedQuery
setMaxResults
in interface Query
setMaxResults
in interface TypedQuery
setMaxResults
in interface FullTextQuery
setMaxResults
in class AbstractProducedQuery
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
getMaxResults
in class AbstractProducedQuery
public FullTextQuery setFirstResult(int firstResult)
TypedQuery
setFirstResult
in interface Query
setFirstResult
in interface TypedQuery
setFirstResult
in interface FullTextQuery
setFirstResult
in class AbstractProducedQuery
firstResult
- position of the first result,
numbered from 0public int getFirstResult()
Query
setFirstResult
was not applied to the
query object.getFirstResult
in interface Query
getFirstResult
in class AbstractProducedQuery
public FullTextQuery setHint(String hintName, Object value)
TypedQuery
setHint
in interface Query
setHint
in interface TypedQuery
setHint
in interface FullTextQuery
setHint
in class AbstractProducedQuery
hintName
- name of property or hintvalue
- value for the property or hintpublic Map<String,Object> getHints()
Query
getHints
in interface Query
getHints
in class AbstractProducedQuery
public FullTextQueryImpl setParameter(Parameter tParameter, Object t)
TypedQuery
Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
tParameter
- parameter objectt
- parameter valuepublic FullTextQueryImpl setParameter(Parameter calendarParameter, Calendar calendar, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
calendarParameter
- parameter objectcalendar
- parameter valuetemporalType
- temporal typepublic FullTextQueryImpl setParameter(Parameter dateParameter, Date date, TemporalType temporalType)
TypedQuery
java.util.Date
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
dateParameter
- parameter objectdate
- parameter valuetemporalType
- temporal typepublic FullTextQueryImpl setParameter(String name, Object value)
TypedQuery
setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
name
- parameter namevalue
- parameter valuepublic FullTextQueryImpl setParameter(String name, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic FullTextQueryImpl setParameter(String name, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic FullTextQueryImpl setParameter(int position, Object value)
TypedQuery
setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
position
- positionvalue
- parameter valuepublic FullTextQueryImpl setParameter(int position, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a positional parameter.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic Set<Parameter<?>> getParameters()
Query
getParameters
in interface Query
getParameters
in class AbstractProducedQuery
protected QueryParameterBindings getQueryParameterBindings()
getQueryParameterBindings
in class AbstractProducedQuery
public FullTextQueryImpl setParameter(int position, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
setParameter
in interface TypedQuery
setParameter
in class AbstractProducedQuery
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic QueryParameter<?> getParameter(String name)
Query
getParameter
in interface Query
getParameter
in class AbstractProducedQuery
name
- parameter namepublic QueryParameter<?> getParameter(int position)
Query
getParameter
in interface Query
getParameter
in class AbstractProducedQuery
position
- positionpublic QueryParameter getParameter(String name, Class type)
Query
getParameter
in interface Query
getParameter
in class AbstractProducedQuery
name
- parameter nametype
- typepublic QueryParameter getParameter(int position, Class type)
Query
getParameter
in interface Query
getParameter
in class AbstractProducedQuery
position
- positiontype
- typepublic boolean isBound(Parameter param)
Query
isBound
in interface Query
isBound
in class AbstractProducedQuery
param
- parameter objectpublic Object getParameterValue(Parameter param)
Query
getParameterValue
in interface Query
getParameterValue
in class AbstractProducedQuery
param
- parameter objectpublic Object getParameterValue(String name)
Query
getParameterValue
in interface Query
getParameterValue
in class AbstractProducedQuery
name
- parameter namepublic Object getParameterValue(int position)
Query
getParameterValue
in interface Query
getParameterValue
in class AbstractProducedQuery
position
- positionpublic FullTextQueryImpl setFlushMode(FlushModeType flushModeType)
TypedQuery
setFlushMode
in interface Query
setFlushMode
in interface TypedQuery
setFlushMode
in interface FullTextQuery
setFlushMode
in class AbstractProducedQuery
flushModeType
- flush modepublic FullTextQueryImpl setFetchSize(int fetchSize)
Query
setFetchSize
in interface BasicQueryContract<CommonQueryContract>
setFetchSize
in class AbstractProducedQuery
fetchSize
- the fetch size hintthis
, for method chainingQuery.getFetchSize()
public QueryImplementor setLockOptions(LockOptions lockOptions)
Query
Query.setLockMode(String, LockMode)
.setLockOptions
in class AbstractProducedQuery
lockOptions
- The lock options to apply to the query.this
, for method chainingQuery.getLockOptions()
@Deprecated public FullTextQueryImpl setResultTransformer(ResultTransformer transformer)
Query
setResultTransformer
in interface FullTextQuery
setResultTransformer
in class AbstractProducedQuery
transformer
- The transformer to applypublic Object unwrap(Class type)
Query
PersistenceException
is thrown.unwrap
in interface Query
unwrap
in class AbstractProducedQuery
type
- the class of the object to be returned. This is
normally either the underlying query
implementation class or an interface that it
implements.public FullTextQueryImpl setLockMode(LockModeType lockModeType)
TypedQuery
setLockMode
in interface Query
setLockMode
in interface TypedQuery
setLockMode
in class AbstractProducedQuery
lockModeType
- lock modepublic LockModeType getLockMode()
Query
getLockMode
in interface Query
getLockMode
in class AbstractProducedQuery
public LockOptions getLockOptions()
Query
getLockOptions
in class AbstractProducedQuery
LockOptions
public int executeUpdate()
Query
executeUpdate
in interface Query
executeUpdate
in class AbstractProducedQuery
public QueryImplementor setLockMode(String alias, LockMode lockMode)
Query
LockOptions
.
The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally
speaking, for maximum portability, this method should only be used to mark that the rows corresponding to
the given alias should be included in pessimistic locking (LockMode.PESSIMISTIC_WRITE
).setLockMode
in class AbstractProducedQuery
alias
- a query alias, or "this"
for a collection filterlockMode
- The lock mode to apply.this
, for method chainingQuery.getLockOptions()
protected Map getLockModes()
public org.hibernate.search.filter.FullTextFilter enableFullTextFilter(String name)
FullTextQuery
enableFullTextFilter
in interface FullTextQuery
name
- the name of the filterFullTextFilter
object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
FullTextQuery
disableFullTextFilter
in interface FullTextQuery
name
- the filter nanepublic org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
getFacetManager
in interface FullTextQuery
public FullTextQueryImpl setTimeout(int timeout)
Query
setTimeout
in interface BasicQueryContract<CommonQueryContract>
setTimeout
in class AbstractProducedQuery
timeout
- the timeout in secondsthis
, for method chainingQuery.getTimeout()
public FullTextQueryImpl setTimeout(long timeout, TimeUnit timeUnit)
FullTextQuery
QueryTimeoutException
is raised.setTimeout
in interface FullTextQuery
timeout
- time out periodtimeUnit
- time out unitthis
to allow method chainingpublic FullTextQueryImpl limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQuery
FullTextQuery.hasPartialResults()
returns true.limitExecutionTimeTo
in interface FullTextQuery
timeout
- time out periodtimeUnit
- time out unitthis
for method chainingpublic boolean hasPartialResults()
hasPartialResults
in interface 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.public FullTextQueryImpl initializeObjectsWith(org.hibernate.search.query.ObjectLookupMethod lookupMethod, org.hibernate.search.query.DatabaseRetrievalMethod retrievalMethod)
FullTextQuery
initializeObjectsWith
in interface FullTextQuery
lookupMethod
- lookup methodretrievalMethod
- how to initilize an objectthis
for method chainingpublic String getQueryString()
Query
protected boolean isNativeQuery()
AbstractProducedQuery
isNativeQuery
in class AbstractProducedQuery
true
if it is a native query; false
otherwise@Deprecated public Type[] getReturnTypes()
Query
getReturnTypes
in interface BasicQueryContract<CommonQueryContract>
@Deprecated public String[] getReturnAliases()
@Deprecated public FullTextQueryImpl setEntity(int position, Object val)
Query
Query.setParameter(int, Object)
for null values.position
- the position of the parameter in the query
string, numbered from 0.val
- a non-null instance of a persistent classthis
, for method chaining@Deprecated public FullTextQueryImpl setEntity(String name, Object val)
Query
Query.setParameter(String, Object)
for null values.name
- the name of the parameterval
- a non-null instance of a persistent classthis
, for method chainingCopyright © 2019 JBoss by Red Hat. All rights reserved.