Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.search.query
Class FullTextQueryImpl

    java.lang.Object
      org.hibernate.impl.AbstractQueryImpl
          org.hibernate.search.query.FullTextQueryImpl

All Implemented Interfaces:
  org.hibernate.Query, FullTextQuery, ProjectionConstants

    public class FullTextQueryImpl

extends org.hibernate.impl.AbstractQueryImpl
implements FullTextQuery

Implementation of `FullTextQuery`.

Author:
  Emmanuel Bernard, Hardy Ferentschik

Field Summary

Fields inherited from class org.hibernate.impl.AbstractQueryImpl
`parameterMetadata, session`

Fields inherited from interface org.hibernate.search.ProjectionConstants
`BOOST, DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, THIS`

Constructor Summary
`FullTextQueryImpl(org.apache.lucene.search.Query query, java.lang.Class<?>[] classes, org.hibernate.engine.SessionImplementor session, org.hibernate.engine.query.ParameterMetadata parameterMetadata)` Constructs a `FullTextQueryImpl` instance.

Method Summary
`void` | `disableFullTextFilter(java.lang.String name)` Disable a given filter by its name
`FullTextFilter` | `enableFullTextFilter(java.lang.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
`protected java.util.Map` | `getLockModes()`
`org.hibernate.LockOptions` | `getLockOptions()`
`int` | `getResultSize()` Returns the number of hits for this search 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.
`java.util.Iterator` | `iterate()` Return an iterator on the results.
`java.util.List` | `list()`
`org.hibernate.ScrollableResults` | `scroll()`
`org.hibernate.ScrollableResults` | `scroll(org.hibernate.ScrollMode scrollMode)`
`FullTextQuery` | `setCriteriaQuery(org.hibernate.Criteria criteria)` Defines the Database Query used to load the Lucene results.
`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 use lucene filters.
`FullTextQuery` | `setFirstResult(int firstResult)` {link:Query#setFirstResult}
`org.hibernate.Query` | `setLockMode(java.lang.String alias, org.hibernate.LockMode lockMode)`
`org.hibernate.Query` | `setLockOptions(org.hibernate.LockOptions lockOptions)`
`FullTextQuery` | `setMaxResults(int maxResults)` {link:Query#setMaxResults}
`FullTextQuery` | `setProjection(java.lang.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.
`
`<T> T`
` | `unwrap(java.lang.Class<T> type)` return the underlying type if possible or IllegalArgumentException otherwise Supported types are: - org.apache.lucene.search.Query the underlying lucene query

Methods inherited from class org.hibernate.impl.AbstractQueryImpl
`after, before, determineType, determineType, determineType, determineType, determineType, expandParameterLists, getCacheMode, getNamedParameterLists, getNamedParameters, getNamedParams, getParameterMetadata, getQueryParameters, getQueryString, getReturnAliases, getReturnTypes, getRowSelection, getSelection, getTypes, getValues, hasNamedParameters, isReadOnly, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setCollectionKey, setComment, setDate, setDate, setDouble, setDouble, setEntity, setEntity, setFloat, setFloat, setFlushMode, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setOptionalEntityName, setOptionalId, setOptionalObject, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setReadOnly, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimeout, setTimestamp, setTimestamp, toString, typeArray, uniqueResult, valueArray, verifyParameters, verifyParameters`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.hibernate.Query
`getNamedParameters, getQueryString, getReturnAliases, getReturnTypes, isReadOnly, 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, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setReadOnly, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimeout, setTimestamp, setTimestamp, uniqueResult`

Constructor Detail

### FullTextQueryImpl

    public FullTextQueryImpl(org.apache.lucene.search.Query query,
                             java.lang.Class<?>[] classes,
                             org.hibernate.engine.SessionImplementor session,
                             org.hibernate.engine.query.ParameterMetadata parameterMetadata)

  Constructs a `FullTextQueryImpl` instance.

  Parameters:
    `query` - The Lucene query.
    `classes` - Array of classes (must be immutable) used to filter the results to the given class types.
    `session` - Access to the Hibernate session.
    `parameterMetadata` - Additional query metadata.

Method Detail

### setSort

    public FullTextQuery setSort(org.apache.lucene.search.Sort sort)

  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

    public FullTextQuery setFilter(org.apache.lucene.search.Filter filter)

  Allows to use lucene filters. Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach

  Specified by:
    `setFilter` in interface `FullTextQuery`
  Parameters:
    `filter` - The lucene filter.
  Returns:
    this for method chaining

### iterate

    public java.util.Iterator iterate()
                               throws org.hibernate.HibernateException

  Return an iterator on the results. Retrieve the object one by one (initialize it during the next() operation)

  Specified by:
    `iterate` in interface `org.hibernate.Query`
  Throws:
    `org.hibernate.HibernateException`

### scroll

    public org.hibernate.ScrollableResults scroll()
                                           throws org.hibernate.HibernateException

  Specified by:
    `scroll` in interface `org.hibernate.Query`
  Throws:
    `org.hibernate.HibernateException`

### scroll

    public org.hibernate.ScrollableResults scroll(org.hibernate.ScrollMode scrollMode)
                                           throws org.hibernate.HibernateException

  Specified by:
    `scroll` in interface `org.hibernate.Query`
  Throws:
    `org.hibernate.HibernateException`

### list

    public java.util.List list()
                        throws org.hibernate.HibernateException

  Specified by:
    `list` in interface `org.hibernate.Query`
  Throws:
    `org.hibernate.HibernateException`

### explain

    public org.apache.lucene.search.Explanation explain(int documentId)

  Description copied from interface: `FullTextQuery`
  Return the Lucene `Explanation` object describing the score computation for the matching object/document in the current query

  Specified by:
    `explain` in interface `FullTextQuery`
  Parameters:
    `documentId` - Lucene Document id to be explain. This is NOT the object id
  Returns:
    Lucene Explanation

### getResultSize

    public int getResultSize()

  Description copied from interface: `FullTextQuery`
  Returns the number of hits for this search

  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.

  Specified by:
    `getResultSize` in interface `FullTextQuery`

### setCriteriaQuery

    public FullTextQuery setCriteriaQuery(org.hibernate.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`

### setProjection

    public FullTextQuery setProjection(java.lang.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`

### setFirstResult

    public FullTextQuery setFirstResult(int firstResult)

  Description copied from interface: `FullTextQuery`
  {link:Query#setFirstResult}

  Specified by:
    `setFirstResult` in interface `org.hibernate.Query`
  Specified by:
    `setFirstResult` in interface `FullTextQuery`
  Overrides:
    `setFirstResult` in class `org.hibernate.impl.AbstractQueryImpl`

### setMaxResults

    public FullTextQuery setMaxResults(int maxResults)

  Description copied from interface: `FullTextQuery`
  {link:Query#setMaxResults}

  Specified by:
    `setMaxResults` in interface `org.hibernate.Query`
  Specified by:
    `setMaxResults` in interface `FullTextQuery`
  Overrides:
    `setMaxResults` in class `org.hibernate.impl.AbstractQueryImpl`

### setFetchSize

    public FullTextQuery setFetchSize(int fetchSize)

  Description copied from interface: `FullTextQuery`
  Defines scrollable result fetch size as well as the JDBC fetch size

  Specified by:
    `setFetchSize` in interface `org.hibernate.Query`
  Specified by:
    `setFetchSize` in interface `FullTextQuery`
  Overrides:
    `setFetchSize` in class `org.hibernate.impl.AbstractQueryImpl`

### setLockOptions

    public org.hibernate.Query setLockOptions(org.hibernate.LockOptions lockOptions)

  Specified by:
    `setLockOptions` in interface `org.hibernate.Query`

### setResultTransformer

    public FullTextQuery setResultTransformer(org.hibernate.transform.ResultTransformer transformer)

  Description copied from interface: `FullTextQuery`
  defines a result transformer used during projection, the Aliases provided are the projection aliases.

  Specified by:
    `setResultTransformer` in interface `org.hibernate.Query`
  Specified by:
    `setResultTransformer` in interface `FullTextQuery`
  Overrides:
    `setResultTransformer` in class `org.hibernate.impl.AbstractQueryImpl`

### unwrap

    public <T> T unwrap(java.lang.Class<T> type)

  Description copied from interface: `FullTextQuery`
  return the underlying type if possible or IllegalArgumentException otherwise Supported types are: - org.apache.lucene.search.Query the underlying lucene query

  Specified by:
    `unwrap` in interface `FullTextQuery`

### getLockOptions

    public org.hibernate.LockOptions getLockOptions()

  Specified by:
    `getLockOptions` in class `org.hibernate.impl.AbstractQueryImpl`

### executeUpdate

    public int executeUpdate()
                      throws org.hibernate.HibernateException

  Specified by:
    `executeUpdate` in interface `org.hibernate.Query`
  Throws:
    `org.hibernate.HibernateException`

### setLockMode

    public org.hibernate.Query setLockMode(java.lang.String alias,
                                           org.hibernate.LockMode lockMode)

  Specified by:
    `setLockMode` in interface `org.hibernate.Query`

### getLockModes

    protected java.util.Map getLockModes()

### enableFullTextFilter

    public FullTextFilter enableFullTextFilter(java.lang.String name)

  Description copied from interface: `FullTextQuery`
  Enable a given filter by its name. Returns a FullTextFilter object that allows filter parameter injection

  Specified by:
    `enableFullTextFilter` in interface `FullTextQuery`

### disableFullTextFilter

    public void disableFullTextFilter(java.lang.String name)

  Description copied from interface: `FullTextQuery`
  Disable a given filter by its name

  Specified by:
    `disableFullTextFilter` in interface `FullTextQuery`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 Hibernate. All Rights Reserved.