public class FullTextQueryImpl extends AbstractProducedQuery implements FullTextQuery
FullTextQuery
.DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS
Constructor and Description |
---|
FullTextQueryImpl(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.
|
FullTextFilter |
enableFullTextFilter(String name)
Enable a given filter by its name.
|
int |
executeUpdate() |
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() |
LockOptions |
getLockOptions() |
String |
getQueryString() |
List |
getResultList() |
int |
getResultSize() |
String[] |
getReturnAliases() |
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() |
ScrollableResultsImplementor |
scroll(ScrollMode scrollMode) |
FullTextQuery |
setCriteriaQuery(Criteria criteria)
Defines the Database Query used to load the Lucene results.
|
FullTextQuery |
setEntity(int position,
Object val) |
FullTextQuery |
setEntity(String name,
Object val) |
FullTextQuery |
setFetchSize(int fetchSize)
Defines scrollable result fetch size as well as the JDBC fetch size
|
FullTextQuery |
setFilter(Filter filter)
Allows to set a single Lucene filter.
|
FullTextQuery |
setFirstResult(int firstResult) |
QueryImplementor |
setLockMode(String alias,
LockMode lockMode) |
QueryImplementor |
setLockOptions(LockOptions lockOptions) |
FullTextQuery |
setMaxResults(int maxResults) |
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, the Aliases provided are the projection aliases.
|
FullTextQuery |
setSort(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() |
Object |
unwrap(Class type) |
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, 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, uniqueResultOptional
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProducer, setOptionalEntityName, setOptionalId, setOptionalObject
addQueryHint, getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getParameterMetadata, getQueryOptions, 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, setFlushMode, setHibernateFlushMode, setHint, setInteger, setInteger, setLocale, setLocale, setLockMode, setLong, setLong, 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, setParameters, setProperties, setProperties, setReadOnly, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp, stream, uniqueResult, uniqueResultOptional
determineProperBooleanType, determineProperBooleanType, getFlushMode, getNamedParameters, getTimeout, isCacheable, isReadOnly
public FullTextQueryImpl(HSQuery hSearchQuery, SessionImplementor session, 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(Sort sort)
FullTextQuery
setSort
in interface FullTextQuery
sort
- The lucene sort object.public FullTextQuery setFilter(Filter filter)
FullTextQuery
setFilter
in interface FullTextQuery
filter
- The Lucene filter.Filter
public List getResultList()
getResultList
in interface javax.persistence.Query
getResultList
in interface javax.persistence.TypedQuery
public Iterator iterate()
iterate
in class AbstractProducedQuery
public ScrollableResultsImpl scroll()
scroll
in class AbstractProducedQuery
public ScrollableResultsImplementor scroll(ScrollMode scrollMode)
scroll
in class AbstractProducedQuery
public List list()
list
in class AbstractProducedQuery
public 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
instancepublic int getResultSize()
getResultSize
in interface FullTextQuery
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(Criteria criteria)
FullTextQuery
criteria.setProjection()
) allowed, the root entity must be the only returned typesetCriteriaQuery
in interface FullTextQuery
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
fields
- list of field names to project onthis
for method chainingpublic FullTextQuery setSpatialParameters(Coordinates center, String fieldName)
FullTextQuery
setSpatialParameters
in interface FullTextQuery
center
- the search centerfieldName
- name of the spatial fieldthis
for method chainingpublic 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 setFirstResult(int firstResult)
FullTextQuery
setFirstResult
in interface javax.persistence.Query
setFirstResult
in interface javax.persistence.TypedQuery
setFirstResult
in interface FullTextQuery
setFirstResult
in class AbstractProducedQuery
public FullTextQuery setMaxResults(int maxResults)
FullTextQuery
setMaxResults
in interface javax.persistence.Query
setMaxResults
in interface javax.persistence.TypedQuery
setMaxResults
in interface FullTextQuery
setMaxResults
in class AbstractProducedQuery
public FullTextQuery setFetchSize(int fetchSize)
FullTextQuery
setFetchSize
in interface BasicQueryContract
setFetchSize
in interface FullTextQuery
setFetchSize
in class AbstractProducedQuery
public QueryImplementor setLockOptions(LockOptions lockOptions)
setLockOptions
in class AbstractProducedQuery
public FullTextQuery setResultTransformer(ResultTransformer transformer)
FullTextQuery
setResultTransformer
in interface FullTextQuery
setResultTransformer
in class AbstractProducedQuery
public Object unwrap(Class type)
unwrap
in interface javax.persistence.Query
unwrap
in interface FullTextQuery
unwrap
in class AbstractProducedQuery
type
- the type to unwrapIllegalArgumentException
is thrown. Supported types are:
public LockOptions getLockOptions()
getLockOptions
in class AbstractProducedQuery
public int executeUpdate()
executeUpdate
in interface javax.persistence.Query
executeUpdate
in class AbstractProducedQuery
public QueryImplementor setLockMode(String alias, LockMode lockMode)
setLockMode
in class AbstractProducedQuery
protected Map getLockModes()
public FullTextFilter enableFullTextFilter(String name)
FullTextQuery
enableFullTextFilter
in interface FullTextQuery
name
- the name of the filter to enableFullTextFilter
object that allows filter parameter injectionpublic void disableFullTextFilter(String name)
FullTextQuery
disableFullTextFilter
in interface FullTextQuery
name
- the name of the filter to disable.public FacetManager getFacetManager()
getFacetManager
in interface FullTextQuery
public FullTextQuery setTimeout(int timeout)
setTimeout
in interface BasicQueryContract
setTimeout
in class AbstractProducedQuery
public FullTextQuery setTimeout(long timeout, TimeUnit timeUnit)
FullTextQuery
QueryTimeoutException
is raised.setTimeout
in interface FullTextQuery
timeout
- time out periodtimeUnit
- time out unitthis
to allow method chainingpublic FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
FullTextQuery
FullTextQuery.hasPartialResults()
returns true.limitExecutionTimeTo
in interface FullTextQuery
timeout
- time out periodtimeUnit
- time out unitthis
to allow method chainingpublic boolean hasPartialResults()
FullTextQuery
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 FullTextQuery initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)
FullTextQuery
initializeObjectsWith
in interface FullTextQuery
lookupMethod
- the lookuip strategyretrievalMethod
- the retrieval strategythis
to allow method chainingpublic String getQueryString()
protected boolean isNativeQuery()
isNativeQuery
in class AbstractProducedQuery
public Type[] getReturnTypes()
getReturnTypes
in interface BasicQueryContract
public String[] getReturnAliases()
public FullTextQuery setEntity(int position, Object val)
public FullTextQuery setEntity(String name, Object val)
Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved