public class FullTextQueryImpl<R> extends org.hibernate.query.internal.AbstractProducedQuery<R> implements FullTextQuery<R>
FullTextQuery.DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS| Constructor and Description |
|---|
FullTextQueryImpl(HSQuery hSearchQuery,
org.hibernate.engine.spi.SessionImplementor session,
org.hibernate.query.ParameterMetadata parameterMetadata)
Constructs a
FullTextQueryImpl instance. |
| 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() |
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 |
FacetManager |
getFacetManager() |
protected Map |
getLockModes() |
org.hibernate.LockOptions |
getLockOptions() |
String |
getQueryString() |
List<R> |
getResultList() |
int |
getResultSize() |
String[] |
getReturnAliases() |
org.hibernate.type.Type[] |
getReturnTypes() |
boolean |
hasPartialResults()
Experimental API, subject to change or removal
|
FullTextQuery |
initializeObjectsWith(ObjectLookupMethod lookupMethod,
DatabaseRetrievalMethod retrievalMethod)
Refine the strategies used to load entities.
|
protected boolean |
isNativeQuery() |
Iterator |
iterate()
Return an iterator on the results.
|
FullTextQuery |
limitExecutionTimeTo(long timeout,
TimeUnit timeUnit)
*Experimental* API, subject to change or removal
Limit the time used by Hibernate Search to execute the query.
|
List |
list() |
ScrollableResultsImpl |
scroll() |
org.hibernate.query.spi.ScrollableResultsImplementor |
scroll(org.hibernate.ScrollMode scrollMode) |
FullTextQuery |
setCriteriaQuery(org.hibernate.Criteria criteria)
Defines the Database Query used to load the Lucene results.
|
org.hibernate.Query |
setEntity(int position,
Object val) |
org.hibernate.Query |
setEntity(String name,
Object val) |
FullTextQuery |
setFetchSize(int fetchSize)
Defines scrollable result fetch size as well as the JDBC fetch size
|
FullTextQuery |
setFilter(org.apache.lucene.search.Filter filter)
Allows to set a single Lucene filter.
|
FullTextQuery |
setFirstResult(int firstResult)
Query.setFirstResult(int) |
org.hibernate.query.spi.QueryImplementor |
setLockMode(String alias,
org.hibernate.LockMode lockMode) |
org.hibernate.query.spi.QueryImplementor |
setLockOptions(org.hibernate.LockOptions lockOptions) |
FullTextQuery |
setMaxResults(int maxResults)
Query.setMaxResults(int) |
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(org.hibernate.transform.ResultTransformer transformer)
defines a result transformer used during projection, the Aliases provided are the projection aliases.
|
FullTextQuery |
setSort(org.apache.lucene.search.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
|
FullTextQuery |
setTimeout(int timeout) |
FullTextQuery |
setTimeout(long timeout,
TimeUnit timeUnit)
Define a timeout period for a given unit of time.
|
String |
toString() |
<T> T |
unwrap(Class<T> type) |
addQueryHint, afterQuery, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyEntityGraphQueryHint, applyFetchSizeHint, applyFlushModeHint, applyFollowOnLockingHint, applyHibernateLockModeHint, applyJpaCacheRetrieveMode, applyJpaCacheStoreMode, applyLockModeTypeHint, applyLockTimeoutHint, applyNativeQueryLockMode, applyReadOnlyHint, applyTimeoutHint, beforeQuery, canApplyAliasSpecificLockModeHints, collectBaselineHints, collectHints, determineProperBooleanType, determineProperBooleanType, determineType, doExecuteUpdate, doIterate, doList, doScroll, getCacheMode, getCacheRegion, getComment, getExceptionConverter, getFetchSize, getFirstResult, getFlushMode, getHibernateFlushMode, getHints, getLockMode, getMaxResults, getNamedParameterMap, getNamedParameters, getParameter, getParameter, getParameter, getParameter, getParameterMetadata, getParameters, getParameterValue, getParameterValue, getParameterValue, getPositionalParameterTypes, getPositionalParameterValues, getProducer, getQueryOptions, getQueryParameterBindings, getQueryParameters, getSingleResult, getSupportedHints, getTimeout, isBound, isCacheable, isCallable, isReadOnly, putIfNotNull, putIfNotNull, resolveEntityName, setCacheable, setCacheMode, setCacheRegion, setComment, setFlushMode, setFlushMode, setHibernateFlushMode, setHint, setLockMode, setOptionalEntityName, setOptionalId, setOptionalObject, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setProperties, setProperties, setReadOnly, stream, uniqueElement, uniqueResult, uniqueResultOptionalclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProducer, setOptionalEntityName, setOptionalId, setOptionalObjectgetQueryOptions, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, stream, uniqueResultOptionaldetermineProperBooleanType, determineProperBooleanType, getCacheMode, getCacheRegion, getComment, getFetchSize, getFlushMode, getHibernateFlushMode, getNamedParameters, getParameterMetadata, getSingleResult, getTimeout, isCacheable, isReadOnly, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setDate, setDate, setDouble, setDouble, setFloat, setFloat, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp, uniqueResultpublic FullTextQueryImpl(HSQuery hSearchQuery, org.hibernate.engine.spi.SessionImplementor session, org.hibernate.query.ParameterMetadata parameterMetadata)
FullTextQueryImpl instance.hSearchQuery - The query, with the targeted entities already set if necessary.session - Access to the Hibernate session.parameterMetadata - Additional query metadata.public FullTextQuery setSort(org.apache.lucene.search.Sort sort)
FullTextQuerysetSort in interface FullTextQuery<R>sort - The lucene sort object.public FullTextQuery setFilter(org.apache.lucene.search.Filter filter)
FullTextQuerysetFilter in interface FullTextQuery<R>filter - The Lucene filter.Filterpublic List<R> getResultList()
getResultList in interface javax.persistence.QuerygetResultList in interface javax.persistence.TypedQuery<R>public Iterator iterate()
iterate in class org.hibernate.query.internal.AbstractProducedQuery<R>public ScrollableResultsImpl scroll()
scroll in class org.hibernate.query.internal.AbstractProducedQuery<R>public org.hibernate.query.spi.ScrollableResultsImplementor scroll(org.hibernate.ScrollMode scrollMode)
scroll in class org.hibernate.query.internal.AbstractProducedQuery<R>public List list()
list in class org.hibernate.query.internal.AbstractProducedQuery<R>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 FullTextQuery<R>documentId - Lucene Document id to be explain. This is NOT the object idExplanation instancepublic int getResultSize()
getResultSize in interface FullTextQuery<R>
Caution:
The number of results might be slightly different from
list().size() because list() if the index is
not in sync with the database at the time of query.
public FullTextQuery setCriteriaQuery(org.hibernate.Criteria criteria)
FullTextQuerycriteria.setProjection()) allowed, the root entity must be the only returned typesetCriteriaQuery in interface FullTextQuery<R>criteria - Hibernate criteria query used to load resultsthis for method chainingpublic FullTextQuery setProjection(String... fields)
FullTextQuery
A projectable field must be stored in the Lucene index and use a 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<R>fields - list of field names to project onthis for method chainingpublic FullTextQuery setSpatialParameters(Coordinates center, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuery<R>center - the search centerfieldName - name of the spatial fieldthis for method chainingpublic FullTextQuery setSpatialParameters(double latitude, double longitude, String fieldName)
FullTextQuerysetSpatialParameters in interface FullTextQuery<R>latitude - latitude of the search centerlongitude - longitude of the search centerfieldName - name of the spatial fieldthis for method chainingpublic FullTextQuery setFirstResult(int firstResult)
FullTextQueryQuery.setFirstResult(int)setFirstResult in interface javax.persistence.QuerysetFirstResult in interface javax.persistence.TypedQuery<R>setFirstResult in interface FullTextQuery<R>setFirstResult in class org.hibernate.query.internal.AbstractProducedQuery<R>public FullTextQuery setMaxResults(int maxResults)
FullTextQueryQuery.setMaxResults(int)setMaxResults in interface javax.persistence.QuerysetMaxResults in interface javax.persistence.TypedQuery<R>setMaxResults in interface FullTextQuery<R>setMaxResults in class org.hibernate.query.internal.AbstractProducedQuery<R>public FullTextQuery setFetchSize(int fetchSize)
FullTextQuerysetFetchSize in interface org.hibernate.BasicQueryContractsetFetchSize in interface FullTextQuery<R>setFetchSize in class org.hibernate.query.internal.AbstractProducedQuery<R>public org.hibernate.query.spi.QueryImplementor setLockOptions(org.hibernate.LockOptions lockOptions)
setLockOptions in class org.hibernate.query.internal.AbstractProducedQuery<R>public FullTextQuery setResultTransformer(org.hibernate.transform.ResultTransformer transformer)
FullTextQuerysetResultTransformer in interface FullTextQuery<R>setResultTransformer in class org.hibernate.query.internal.AbstractProducedQuery<R>public <T> T unwrap(Class<T> type)
unwrap in interface javax.persistence.Queryunwrap in interface FullTextQuery<R>unwrap in class org.hibernate.query.internal.AbstractProducedQuery<R>T - the type of the unwrapped objecttype - the type to unwrapIllegalArgumentException is thrown. Supported types are:
public org.hibernate.LockOptions getLockOptions()
getLockOptions in class org.hibernate.query.internal.AbstractProducedQuery<R>public int executeUpdate()
executeUpdate in interface javax.persistence.QueryexecuteUpdate in class org.hibernate.query.internal.AbstractProducedQuery<R>public org.hibernate.query.spi.QueryImplementor setLockMode(String alias, org.hibernate.LockMode lockMode)
setLockMode in class org.hibernate.query.internal.AbstractProducedQuery<R>protected Map getLockModes()
public FullTextFilter enableFullTextFilter(String name)
FullTextQueryenableFullTextFilter in interface FullTextQuery<R>name - the name of the filter to enableFullTextFilter object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
FullTextQuerydisableFullTextFilter in interface FullTextQuery<R>name - the name of the filter to disable.public FacetManager getFacetManager()
getFacetManager in interface FullTextQuery<R>public FullTextQuery setTimeout(int timeout)
setTimeout in interface org.hibernate.BasicQueryContractsetTimeout in class org.hibernate.query.internal.AbstractProducedQuery<R>public FullTextQuery setTimeout(long timeout, TimeUnit timeUnit)
FullTextQueryQueryTimeoutException is raised.setTimeout in interface FullTextQuery<R>timeout - time out periodtimeUnit - time out unitthis to allow method chainingpublic FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQueryFullTextQuery.hasPartialResults() returns true.limitExecutionTimeTo in interface FullTextQuery<R>timeout - time out periodtimeUnit - time out unitthis to allow method chainingpublic boolean hasPartialResults()
FullTextQueryhasPartialResults in interface FullTextQuery<R>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 FullTextQuery initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)
FullTextQueryinitializeObjectsWith in interface FullTextQuery<R>lookupMethod - the lookuip strategyretrievalMethod - the retrieval strategythis to allow method chainingpublic String getQueryString()
protected boolean isNativeQuery()
isNativeQuery in class org.hibernate.query.internal.AbstractProducedQuery<R>public org.hibernate.type.Type[] getReturnTypes()
getReturnTypes in interface org.hibernate.BasicQueryContractpublic String[] getReturnAliases()
public org.hibernate.Query setEntity(int position,
Object val)
Copyright © 2006–2016 Hibernate. All rights reserved.