Interface FullTextQuery

All Superinterfaces:
org.hibernate.BasicQueryContract, org.hibernate.query.CommonQueryContract, FullTextQuery, ProjectionConstants, javax.persistence.Query, org.hibernate.Query, org.hibernate.query.Query, org.hibernate.query.spi.QueryImplementor, javax.persistence.TypedQuery

@Deprecated public interface FullTextQuery extends FullTextQuery, org.hibernate.query.spi.QueryImplementor
Deprecated.
Instead of using Hibernate Search 5 APIs, get a SearchSession using Search.session(Session), then create a SearchQuery with SearchSession.search(Class). If you really need an adapter to Hibernate ORM's Query type, convert that SearchQuery using Search.toOrmQuery(SearchQuery), but be aware that only part of the contract is implemented. Refer to the migration guide for more information.
The base interface for full-text queries using the Hibernate ORM API (Query).

This also extends the JPA counterpart, FullTextQuery.

Author:
Hardy Ferentschik, Emmanuel Bernard
  • Field Summary

    Fields inherited from interface org.hibernate.search.engine.ProjectionConstants

    DOCUMENT, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS
  • Method Summary

    Modifier and Type
    Method
    Description
    applyFetchGraph(org.hibernate.graph.RootGraph graph)
    Deprecated.
     
    applyGraph(org.hibernate.graph.RootGraph graph, org.hibernate.graph.GraphSemantic semantic)
    Deprecated.
     
    applyLoadGraph(org.hibernate.graph.RootGraph graph)
    Deprecated.
     
    Deprecated.
    Refine the strategies used to load entities.
    limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
    Deprecated.
    Limit the time used by Hibernate Search to execute the query.
    setFetchSize(int i)
    Deprecated.
    Instead of using Hibernate Search 5 APIs, get a SearchSession using Search.session(EntityManager), create a search query with SearchSession.search(Class), and define your loading options using SearchQueryOptionsStep.loading(Consumer).
    setFirstResult(int firstResult)
    Deprecated.
    setFlushMode(javax.persistence.FlushModeType flushMode)
    Deprecated.
     
    setHint(String hintName, Object value)
    Deprecated.
     
    setMaxResults(int maxResults)
    Deprecated.
    setProjection(String... fields)
    Deprecated.
    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).
    setResultTransformer(org.hibernate.transform.ResultTransformer transformer)
    Deprecated.
    Instead of using Hibernate Search 5 APIs, get a SearchSession using Search.session(Session), create a search query with SearchSession.search(Class), and define your projections using SearchQuerySelectStep.select(Function).
    setSort(Sort sort)
    Deprecated.
    Allows to let lucene sort the results.
    setSpatialParameters(double latitude, double longitude, String fieldName)
    Deprecated.
    Defines the center of the spatial search for this query to project distance in results
    Deprecated.
    Defines the center of the spatial search for this query to project distance in results
    setTimeout(long timeout, TimeUnit timeUnit)
    Deprecated.
    Define a timeout period for a given unit of time.
    <T> T
    unwrap(Class<T> type)
    Deprecated.
     

    Methods inherited from interface org.hibernate.search.jpa.FullTextQuery

    explain, getFacetManager, getResultSize, hasPartialResults

    Methods inherited from interface javax.persistence.Query

    executeUpdate, getFirstResult, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound

    Methods inherited from interface org.hibernate.Query

    determineProperBooleanType, determineProperBooleanType, getFlushMode, getHibernateFirstResult, getHibernateMaxResults, getNamedParameters, getQueryOptions, getReturnAliases, getReturnTypes, getTimeout, isCacheable, isReadOnly, iterate, setHibernateFirstResult, setHibernateMaxResults, setParameterList, setParameterList, setParameterList, setParameterList

    Methods inherited from interface org.hibernate.query.Query

    addQueryHint, getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getLockOptions, getParameterMetadata, getQueryString, getResultList, getResultStream, getSingleResult, list, scroll, scroll, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setComment, setDate, setDate, setDouble, setDouble, setEntity, setEntity, setFloat, setFloat, setFlushMode, setHibernateFlushMode, setInteger, setInteger, setLocale, setLocale, setLockMode, setLockMode, setLockOptions, 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, setTimeout, setTimestamp, setTimestamp, stream, uniqueResult, uniqueResultOptional

    Methods inherited from interface org.hibernate.query.spi.QueryImplementor

    getProducer, setOptionalEntityName, setOptionalId, setOptionalObject
  • Method Details

    • setResultTransformer

      @Deprecated FullTextQuery setResultTransformer(org.hibernate.transform.ResultTransformer transformer)
      Deprecated.
      Instead of using Hibernate Search 5 APIs, get a SearchSession using Search.session(Session), create a search query with SearchSession.search(Class), and define your projections using SearchQuerySelectStep.select(Function). See in particular the composite projection, which allows applying a function to another projection: SearchProjectionFactory.composite(). Refer to the migration guide for more information.
      defines a result transformer used during projection, the Aliases provided are the projection aliases.
      Specified by:
      setResultTransformer in interface FullTextQuery
      Specified by:
      setResultTransformer in interface org.hibernate.Query
      Specified by:
      setResultTransformer in interface org.hibernate.query.Query
      Parameters:
      transformer - the ResultTransformer to use during projection
      Returns:
      this for method chaining
    • unwrap

      <T> T unwrap(Class<T> type)
      Deprecated.
      Specified by:
      unwrap in interface javax.persistence.Query
      Type Parameters:
      T - the type of the unwrapped object
      Parameters:
      type - the type to unwrap
      Returns:
      the underlying type if possible. If not possible to unwrap to the given type an IllegalArgumentException is thrown. Supported types are:
      • org.apache.lucene.search.Query the underlying lucene query
    • setSort

      FullTextQuery setSort(Sort sort)
      Deprecated.
      Description copied from interface: FullTextQuery
      Allows to let lucene sort the results. This is useful when you have additional sort requirements on top of the default lucene ranking. Without lucene sorting you would have to retrieve the full result set and order the hibernate objects.
      Specified by:
      setSort in interface FullTextQuery
      Parameters:
      sort - The lucene sort object.
      Returns:
      this for method chaining
    • applyGraph

      FullTextQuery applyGraph(org.hibernate.graph.RootGraph graph, org.hibernate.graph.GraphSemantic semantic)
      Deprecated.
      Specified by:
      applyGraph in interface org.hibernate.query.Query
    • applyFetchGraph

      default FullTextQuery applyFetchGraph(org.hibernate.graph.RootGraph graph)
      Deprecated.
      Specified by:
      applyFetchGraph in interface org.hibernate.query.Query
    • applyLoadGraph

      default FullTextQuery applyLoadGraph(org.hibernate.graph.RootGraph graph)
      Deprecated.
      Specified by:
      applyLoadGraph in interface org.hibernate.query.Query
    • setProjection

      FullTextQuery setProjection(String... fields)
      Deprecated.
      Description copied from interface: FullTextQuery
      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). A projectable field must be stored in the Lucene index and use a two-way field bridge 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[]
      Specified by:
      setProjection in interface FullTextQuery
      Parameters:
      fields - the fields to use for projection
      Returns:
      this for method chaining
    • setSpatialParameters

      FullTextQuery setSpatialParameters(double latitude, double longitude, String fieldName)
      Deprecated.
      Description copied from interface: FullTextQuery
      Defines the center of the spatial search for this query to project distance in results
      Specified by:
      setSpatialParameters in interface FullTextQuery
      Parameters:
      latitude - latitude of the search center
      longitude - longitude of the search center
      fieldName - name of the spatial field
      Returns:
      this for method chaining
    • setSpatialParameters

      FullTextQuery setSpatialParameters(Coordinates center, String fieldName)
      Deprecated.
      Description copied from interface: FullTextQuery
      Defines the center of the spatial search for this query to project distance in results
      Specified by:
      setSpatialParameters in interface FullTextQuery
      Parameters:
      center - the search center
      fieldName - name of the spatial field
      Returns:
      this for method chaining
    • setFirstResult

      FullTextQuery setFirstResult(int firstResult)
      Deprecated.
      Description copied from interface: FullTextQuery
      Specified by:
      setFirstResult in interface FullTextQuery
      Specified by:
      setFirstResult in interface javax.persistence.Query
      Specified by:
      setFirstResult in interface org.hibernate.Query
      Specified by:
      setFirstResult in interface org.hibernate.query.Query
      Specified by:
      setFirstResult in interface javax.persistence.TypedQuery
    • setMaxResults

      FullTextQuery setMaxResults(int maxResults)
      Deprecated.
      Description copied from interface: FullTextQuery
      Specified by:
      setMaxResults in interface FullTextQuery
      Specified by:
      setMaxResults in interface javax.persistence.Query
      Specified by:
      setMaxResults in interface org.hibernate.Query
      Specified by:
      setMaxResults in interface org.hibernate.query.Query
      Specified by:
      setMaxResults in interface javax.persistence.TypedQuery
    • setHint

      FullTextQuery setHint(String hintName, Object value)
      Deprecated.
      Specified by:
      setHint in interface FullTextQuery
      Specified by:
      setHint in interface javax.persistence.Query
      Specified by:
      setHint in interface org.hibernate.Query
      Specified by:
      setHint in interface org.hibernate.query.Query
      Specified by:
      setHint in interface javax.persistence.TypedQuery
    • setFlushMode

      FullTextQuery setFlushMode(javax.persistence.FlushModeType flushMode)
      Deprecated.
      Specified by:
      setFlushMode in interface FullTextQuery
      Specified by:
      setFlushMode in interface javax.persistence.Query
      Specified by:
      setFlushMode in interface org.hibernate.Query
      Specified by:
      setFlushMode in interface org.hibernate.query.Query
      Specified by:
      setFlushMode in interface javax.persistence.TypedQuery
    • setFetchSize

      FullTextQuery setFetchSize(int i)
      Deprecated.
      Instead of using Hibernate Search 5 APIs, get a SearchSession using Search.session(EntityManager), create a search query with SearchSession.search(Class), and define your loading options using SearchQueryOptionsStep.loading(Consumer). To set the equivalent to setFetchSize(int) in Hibernate Search 6, use SearchLoadingOptionsStep.fetchSize(int). Refer to the migration guide for more information.
      Specified by:
      setFetchSize in interface org.hibernate.BasicQueryContract
      Specified by:
      setFetchSize in interface org.hibernate.Query
      Specified by:
      setFetchSize in interface org.hibernate.query.Query
    • setTimeout

      FullTextQuery setTimeout(long timeout, TimeUnit timeUnit)
      Deprecated.
      Description copied from interface: FullTextQuery
      Define a timeout period for a given unit of time. Note that this is time out is on a best effort basis. When the query goes beyond the timeout, a QueryTimeoutException is raised.
      Specified by:
      setTimeout in interface FullTextQuery
      Parameters:
      timeout - time out period
      timeUnit - time out unit
      Returns:
      this to allow method chaining
    • limitExecutionTimeTo

      FullTextQuery limitExecutionTimeTo(long timeout, TimeUnit timeUnit)
      Deprecated.
      Description copied from interface: FullTextQuery
      Limit the time used by Hibernate Search to execute the query. When the limit is reached, results already fetched are returned. This time limit is a best effort. The query will likely run for longer than the provided time. The time limit only applies to the interactions between Hibernate Search and Lucene. In other words, a query to the database will not be limited. If the limit is reached and all results are not yet fetched, FullTextQuery.hasPartialResults() returns true.
      Specified by:
      limitExecutionTimeTo in interface FullTextQuery
      Parameters:
      timeout - time out period
      timeUnit - time out unit
      Returns:
      this for method chaining
    • initializeObjectsWith

      FullTextQuery initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)
      Deprecated.
      Description copied from interface: FullTextQuery
      Refine the strategies used to load entities. The lookup method defines whether or not to lookup first in the second level cache or the persistence context before trying to initialize objects from the database. Defaults to SKIP. The database retrieval method defines how objects are loaded from the database. Defaults to QUERY. Note that Hibernate Search can deviate from these choices when it makes sense.
      Specified by:
      initializeObjectsWith in interface FullTextQuery
      Parameters:
      lookupMethod - lookup method
      retrievalMethod - how to initilize an object
      Returns:
      this for method chaining