org.hibernate.search

## Interface FullTextQuery

- All Superinterfaces:
    BasicQueryContract, CommonQueryContract, FullTextQuery, ProjectionConstants, javax.persistence.Query, QueryImplementor, javax.persistence.TypedQuery

      public interface FullTextQuery
      extends FullTextQuery, QueryImplementor

  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, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `FullTextQuery` | `initializeObjectsWith(ObjectLookupMethod lookupMethod, DatabaseRetrievalMethod retrievalMethod)` Refine the strategies used to load entities.
    `FullTextQuery` | `limitExecutionTimeTo(long timeout, TimeUnit timeUnit)` Limit the time used by Hibernate Search to execute the query.
    `FullTextQuery` | `setCriteriaQuery(Criteria criteria)` Defines the Database Query used to load the Lucene results.
    `FullTextQuery` | `setFetchSize(int i)`
    `FullTextQuery` | `setFilter(Filter filter)` Deprecated.
    `FullTextQuery` | `setFirstResult(int firstResult)`
    `FullTextQuery` | `setFlushMode(javax.persistence.FlushModeType flushMode)`
    `FullTextQuery` | `setHint(String hintName, Object value)`
    `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)` Deprecated.
    `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(long timeout, TimeUnit timeUnit)` Define a timeout period for a given unit of time.
    `<T> T` | `unwrap(Class<T> type)`

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

      `disableFullTextFilter, enableFullTextFilter, explain, getFacetManager, getResultSize, hasPartialResults`

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

      `getProducer, setOptionalEntityName, setOptionalId, setOptionalObject`

    - ### Methods inherited from interface org.hibernate.query.Query

      `addQueryHint, getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getLockOptions, getParameterMetadata, getQueryOptions, 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

      `determineProperBooleanType, determineProperBooleanType, getFlushMode, getNamedParameters, getReturnAliases, getReturnTypes, getTimeout, isCacheable, isReadOnly, iterate`

    - ### Methods inherited from interface javax.persistence.Query

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

- - ### Method Detail

    - #### setResultTransformer

          @Deprecated
          FullTextQuery setResultTransformer(ResultTransformer transformer)

      Deprecated.
      defines a result transformer used during projection, the Aliases provided are the projection aliases.
      Specified by:
        `setResultTransformer` in interface `FullTextQuery`
      Parameters:
        `transformer` - the `ResultTransformer` to use during projection
      Returns:
        `this` for method chaining

    - #### unwrap

          <T> T unwrap(Class<T> type)

      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)

      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

    - #### setFilter

          @Deprecated
          FullTextQuery setFilter(Filter filter)

      Deprecated.
      Description copied from interface: `FullTextQuery`
      Allows to set a single Lucene filter.
      Specified by:
        `setFilter` in interface `FullTextQuery`
      Parameters:
        `filter` - The Lucene filter.
      Returns:
        this for method chaining
      See Also:
        `Filter`

    - #### setCriteriaQuery

          FullTextQuery setCriteriaQuery(Criteria criteria)

      Description copied from interface: `FullTextQuery`
      Defines the Database Query used to load the Lucene results. Useful to load a given object graph by refining the fetch modes No projection (criteria.setProjection() ) allowed, the root entity must be the only returned type No where restriction can be defined either.
      Specified by:
        `setCriteriaQuery` in interface `FullTextQuery`
      Parameters:
        `criteria` - a query defined using `Criteria`
      Returns:
        `this` for method chaining

    - #### setProjection

          FullTextQuery setProjection(String... fields)

      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 `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[]
      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)

      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)

      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)

      Specified by:
        `setFirstResult` in interface `FullTextQuery`
      Specified by:
        `setFirstResult` in interface `javax.persistence.Query`
      Specified by:
        `setFirstResult` in interface `javax.persistence.TypedQuery`

    - #### setMaxResults

          FullTextQuery setMaxResults(int maxResults)

      Specified by:
        `setMaxResults` in interface `FullTextQuery`
      Specified by:
        `setMaxResults` in interface `javax.persistence.Query`
      Specified by:
        `setMaxResults` in interface `javax.persistence.TypedQuery`

    - #### setHint

          FullTextQuery setHint(String hintName,
                                Object value)

      Specified by:
        `setHint` in interface `FullTextQuery`
      Specified by:
        `setHint` in interface `javax.persistence.Query`
      Specified by:
        `setHint` in interface `javax.persistence.TypedQuery`

    - #### setFlushMode

          FullTextQuery setFlushMode(javax.persistence.FlushModeType flushMode)

      Specified by:
        `setFlushMode` in interface `FullTextQuery`
      Specified by:
        `setFlushMode` in interface `javax.persistence.Query`
      Specified by:
        `setFlushMode` in interface `javax.persistence.TypedQuery`

    - #### setFetchSize

          FullTextQuery setFetchSize(int i)

      Specified by:
        `setFetchSize` in interface `BasicQueryContract`

    - #### setTimeout

          FullTextQuery setTimeout(long timeout,
                                   TimeUnit timeUnit)

      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)

      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)

      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

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved