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, uniqueResultOptionalclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProducer, setOptionalEntityName, setOptionalId, setOptionalObjectaddQueryHint, 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, uniqueResultOptionaldetermineProperBooleanType, determineProperBooleanType, getFlushMode, getHibernateFirstResult, getHibernateMaxResults, getNamedParameters, getQueryOptions, getTimeout, isCacheable, isReadOnly, setHibernateFirstResult, setHibernateMaxResults, setParameterList, setParameterList, setParameterList, setParameterListpublic 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)
FullTextQuerysetSort in interface FullTextQuerysort - The lucene sort object.@Deprecated public FullTextQueryImpl setFilter(org.apache.lucene.search.Filter filter)
FullTextQuerysetFilter in interface FullTextQueryfilter - The Lucene filter.Filterpublic List getResultList()
QuerygetResultList in interface QuerygetResultList in interface TypedQuerypublic Iterator iterate()
iterate in class AbstractProducedQuerypublic ScrollableResultsImpl scroll()
Query
You should call ScrollableResults.close() after processing the ScrollableResults
so that the underlying resources are deallocated right away.
scroll in class AbstractProducedQueryScrollableResultspublic 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 AbstractProducedQueryscrollMode - The scroll modeScrollableResults,
ScrollModepublic List list()
Querylist in class AbstractProducedQueryprotected List doHibernateSearchList()
public 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 idExplanationpublic int getResultSize()
FullTextQuerygetResultList().size() because getResultList()
may be not in sync with the database at the time of query.getResultSize in interface FullTextQuerypublic int doGetResultSize()
public FullTextQueryImpl setCriteriaQuery(Criteria criteria)
FullTextQuerysetCriteriaQuery in interface FullTextQuerycriteria - a query defined using Criteriathis for method chainingpublic FullTextQueryImpl 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 FullTextQueryfields - the fields to use for projectionthis for method chainingpublic FullTextQueryImpl setSpatialParameters(org.hibernate.search.spatial.Coordinates center, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuerycenter - the search centerfieldName - name of the spatial fieldthis for method chainingpublic FullTextQueryImpl 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 setMaxResults(int maxResults)
TypedQuerysetMaxResults in interface QuerysetMaxResults in interface TypedQuerysetMaxResults in interface FullTextQuerysetMaxResults in class AbstractProducedQuerymaxResults - maximum number of results to retrievepublic int getMaxResults()
QueryInteger.MAX_VALUE if setMaxResults was not
applied to the query object.getMaxResults in interface QuerygetMaxResults in class AbstractProducedQuerypublic FullTextQuery setFirstResult(int firstResult)
TypedQuerysetFirstResult in interface QuerysetFirstResult in interface TypedQuerysetFirstResult in interface FullTextQuerysetFirstResult in class AbstractProducedQueryfirstResult - position of the first result,
numbered from 0public int getFirstResult()
QuerysetFirstResult was not applied to the
query object.getFirstResult in interface QuerygetFirstResult in class AbstractProducedQuerypublic FullTextQuery setHint(String hintName, Object value)
TypedQuerysetHint in interface QuerysetHint in interface TypedQuerysetHint in interface FullTextQuerysetHint in class AbstractProducedQueryhintName - name of property or hintvalue - value for the property or hintpublic Map<String,Object> getHints()
QuerygetHints in interface QuerygetHints in class AbstractProducedQuerypublic FullTextQueryImpl setParameter(Parameter tParameter, Object t)
TypedQueryParameter object.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQuerytParameter - parameter objectt - parameter valuepublic FullTextQueryImpl setParameter(Parameter calendarParameter, Calendar calendar, TemporalType temporalType)
TypedQueryjava.util.Calendar to a Parameter object.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQuerycalendarParameter - parameter objectcalendar - parameter valuetemporalType - temporal typepublic FullTextQueryImpl setParameter(Parameter dateParameter, Date date, TemporalType temporalType)
TypedQueryjava.util.Date to a Parameter object.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQuerydateParameter - parameter objectdate - parameter valuetemporalType - temporal typepublic FullTextQueryImpl setParameter(String name, Object value)
TypedQuerysetParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryname - parameter namevalue - parameter valuepublic FullTextQueryImpl setParameter(String name, Date value, TemporalType temporalType)
TypedQueryjava.util.Date to a named parameter.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryname - parameter namevalue - parameter valuetemporalType - temporal typepublic FullTextQueryImpl setParameter(String name, Calendar value, TemporalType temporalType)
TypedQueryjava.util.Calendar to a named parameter.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryname - parameter namevalue - parameter valuetemporalType - temporal typepublic FullTextQueryImpl setParameter(int position, Object value)
TypedQuerysetParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryposition - positionvalue - parameter valuepublic FullTextQueryImpl setParameter(int position, Date value, TemporalType temporalType)
TypedQueryjava.util.Date to a positional parameter.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryposition - positionvalue - parameter valuetemporalType - temporal typepublic Set<Parameter<?>> getParameters()
QuerygetParameters in interface QuerygetParameters in class AbstractProducedQueryprotected QueryParameterBindings getQueryParameterBindings()
getQueryParameterBindings in class AbstractProducedQuerypublic FullTextQueryImpl setParameter(int position, Calendar value, TemporalType temporalType)
TypedQueryjava.util.Calendar to a positional
parameter.setParameter in interface QuerysetParameter in interface TypedQuerysetParameter in class AbstractProducedQueryposition - positionvalue - parameter valuetemporalType - temporal typepublic QueryParameter<?> getParameter(String name)
QuerygetParameter in interface QuerygetParameter in class AbstractProducedQueryname - parameter namepublic QueryParameter<?> getParameter(int position)
QuerygetParameter in interface QuerygetParameter in class AbstractProducedQueryposition - positionpublic QueryParameter getParameter(String name, Class type)
QuerygetParameter in interface QuerygetParameter in class AbstractProducedQueryname - parameter nametype - typepublic QueryParameter getParameter(int position, Class type)
QuerygetParameter in interface QuerygetParameter in class AbstractProducedQueryposition - positiontype - typepublic boolean isBound(Parameter param)
QueryisBound in interface QueryisBound in class AbstractProducedQueryparam - parameter objectpublic Object getParameterValue(Parameter param)
QuerygetParameterValue in interface QuerygetParameterValue in class AbstractProducedQueryparam - parameter objectpublic Object getParameterValue(String name)
QuerygetParameterValue in interface QuerygetParameterValue in class AbstractProducedQueryname - parameter namepublic Object getParameterValue(int position)
QuerygetParameterValue in interface QuerygetParameterValue in class AbstractProducedQueryposition - positionpublic FullTextQueryImpl setFlushMode(FlushModeType flushModeType)
TypedQuerysetFlushMode in interface QuerysetFlushMode in interface TypedQuerysetFlushMode in interface FullTextQuerysetFlushMode in class AbstractProducedQueryflushModeType - flush modepublic FullTextQueryImpl setFetchSize(int fetchSize)
QuerysetFetchSize in interface BasicQueryContract<CommonQueryContract>setFetchSize in class AbstractProducedQueryfetchSize - the fetch size hintthis, for method chainingQuery.getFetchSize()public QueryImplementor setLockOptions(LockOptions lockOptions)
QueryQuery.setLockMode(String, LockMode).setLockOptions in class AbstractProducedQuerylockOptions - The lock options to apply to the query.this, for method chainingQuery.getLockOptions()@Deprecated public FullTextQueryImpl setResultTransformer(ResultTransformer transformer)
QuerysetResultTransformer in interface FullTextQuerysetResultTransformer in class AbstractProducedQuerytransformer - The transformer to applypublic Object unwrap(Class type)
QueryPersistenceException is thrown.unwrap in interface Queryunwrap in class AbstractProducedQuerytype - 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)
TypedQuerysetLockMode in interface QuerysetLockMode in interface TypedQuerysetLockMode in class AbstractProducedQuerylockModeType - lock modepublic LockModeType getLockMode()
QuerygetLockMode in interface QuerygetLockMode in class AbstractProducedQuerypublic LockOptions getLockOptions()
QuerygetLockOptions in class AbstractProducedQueryLockOptionspublic int executeUpdate()
QueryexecuteUpdate in interface QueryexecuteUpdate in class AbstractProducedQuerypublic QueryImplementor setLockMode(String alias, LockMode lockMode)
QueryLockOptions.
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 AbstractProducedQueryalias - 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)
FullTextQueryenableFullTextFilter in interface FullTextQueryname - the name of the filterFullTextFilter object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
FullTextQuerydisableFullTextFilter in interface FullTextQueryname - the filter nanepublic org.hibernate.search.query.engine.spi.FacetManager getFacetManager()
getFacetManager in interface FullTextQuerypublic FullTextQueryImpl setTimeout(int timeout)
QuerysetTimeout in interface BasicQueryContract<CommonQueryContract>setTimeout in class AbstractProducedQuerytimeout - the timeout in secondsthis, for method chainingQuery.getTimeout()public FullTextQueryImpl setTimeout(long timeout, TimeUnit timeUnit)
FullTextQueryQueryTimeoutException is raised.setTimeout in interface FullTextQuerytimeout - time out periodtimeUnit - time out unitthis to allow method chainingpublic FullTextQueryImpl limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQueryFullTextQuery.hasPartialResults() returns true.limitExecutionTimeTo in interface FullTextQuerytimeout - time out periodtimeUnit - time out unitthis for method chainingpublic boolean hasPartialResults()
hasPartialResults in interface 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.public FullTextQueryImpl initializeObjectsWith(org.hibernate.search.query.ObjectLookupMethod lookupMethod, org.hibernate.search.query.DatabaseRetrievalMethod retrievalMethod)
FullTextQueryinitializeObjectsWith in interface FullTextQuerylookupMethod - lookup methodretrievalMethod - how to initilize an objectthis for method chainingpublic String getQueryString()
Queryprotected boolean isNativeQuery()
AbstractProducedQueryisNativeQuery in class AbstractProducedQuerytrue if it is a native query; false otherwise@Deprecated public Type[] getReturnTypes()
QuerygetReturnTypes in interface BasicQueryContract<CommonQueryContract>@Deprecated public String[] getReturnAliases()
@Deprecated public FullTextQueryImpl setEntity(int position, Object val)
QueryQuery.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)
QueryQuery.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.