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.jpa.impl
Class FullTextQueryImpl

    java.lang.Object
      org.hibernate.search.jpa.impl.FullTextQueryImpl

All Implemented Interfaces:
  javax.persistence.Query, FullTextQuery, ProjectionConstants

    public class FullTextQueryImpl

extends java.lang.Object
implements FullTextQuery

Implements JPA 2 query interface and delegate the call to a Hibernate Core FullTextQuery. This has the consequence of "duplicating" the JPA 2 query logic in some areas.

Author:
  Emmanuel Bernard

Field Summary

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

Constructor Summary
`FullTextQueryImpl(FullTextQuery query, org.hibernate.Session session)`

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
`int` | `getFirstResult()`
`javax.persistence.FlushModeType` | `getFlushMode()`
`java.util.Map<java.lang.String,java.lang.Object>` | `getHints()`
`javax.persistence.LockModeType` | `getLockMode()`
`int` | `getMaxResults()`
`javax.persistence.Parameter<?>` | `getParameter(int position)`
`
`<T> javax.persistence.Parameter<T>`
` | `getParameter(int position, java.lang.Class<T> type)`
`javax.persistence.Parameter<?>` | `getParameter(java.lang.String name)`
`
`<T> javax.persistence.Parameter<T>`
` | `getParameter(java.lang.String name, java.lang.Class<T> type)`
`java.util.Set<javax.persistence.Parameter<?>>` | `getParameters()`
`java.lang.Object` | `getParameterValue(int position)`
`
`<T> T`
` | `getParameterValue(javax.persistence.Parameter<T> param)`
`java.lang.Object` | `getParameterValue(java.lang.String name)`
`java.util.List` | `getResultList()`
`int` | `getResultSize()` Returns the number of hits for this search Caution: The number of results might be slightly different from `getResultList().size()` because getResultList() may be not in sync with the database at the time of query.
`java.lang.Object` | `getSingleResult()`
`boolean` | `isBound(javax.persistence.Parameter<?> param)`
`FullTextQuery` | `setCriteriaQuery(org.hibernate.Criteria criteria)` Defines the Database Query used to load the Lucene results.
`FullTextQuery` | `setFilter(org.apache.lucene.search.Filter filter)` Allows to use lucene filters.
`javax.persistence.Query` | `setFirstResult(int firstResult)`
`javax.persistence.Query` | `setFlushMode(javax.persistence.FlushModeType flushMode)`
`javax.persistence.Query` | `setHint(java.lang.String hintName, java.lang.Object value)`
`javax.persistence.Query` | `setLockMode(javax.persistence.LockModeType lockModeType)`
`javax.persistence.Query` | `setMaxResults(int maxResults)`
`javax.persistence.Query` | `setParameter(int position, java.util.Calendar value, javax.persistence.TemporalType temporalType)`
`javax.persistence.Query` | `setParameter(int position, java.util.Date value, javax.persistence.TemporalType temporalType)`
`javax.persistence.Query` | `setParameter(int position, java.lang.Object value)`
`javax.persistence.Query` | `setParameter(javax.persistence.Parameter<java.util.Calendar> calendarParameter, java.util.Calendar calendar, javax.persistence.TemporalType temporalType)`
`javax.persistence.Query` | `setParameter(javax.persistence.Parameter<java.util.Date> dateParameter, java.util.Date date, javax.persistence.TemporalType temporalType)`
`
`<T> javax.persistence.Query`
` | `setParameter(javax.persistence.Parameter<T> tParameter, T t)`
`javax.persistence.Query` | `setParameter(java.lang.String name, java.util.Calendar value, javax.persistence.TemporalType temporalType)`
`javax.persistence.Query` | `setParameter(java.lang.String name, java.util.Date value, javax.persistence.TemporalType temporalType)`
`javax.persistence.Query` | `setParameter(java.lang.String name, java.lang.Object value)`
`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
`FullTextQuery` | `setSort(org.apache.lucene.search.Sort sort)` Allows to let lucene sort the results.
`
`<T> T`
` | `unwrap(java.lang.Class<T> type)`

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

Constructor Detail

### FullTextQueryImpl

    public FullTextQueryImpl(FullTextQuery query,
                             org.hibernate.Session session)

Method Detail

### setSort

    public FullTextQuery setSort(org.apache.lucene.search.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

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

  Description copied from interface: `FullTextQuery`
  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

### 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 `getResultList().size()` because getResultList() may be 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`

### 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`

### setResultTransformer

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

  Description copied from interface: `FullTextQuery`
  defines a result transformer used during projection

  Specified by:
    `setResultTransformer` in interface `FullTextQuery`

### getResultList

    public java.util.List getResultList()

  Specified by:
    `getResultList` in interface `javax.persistence.Query`

### getSingleResult

    public java.lang.Object getSingleResult()

  Specified by:
    `getSingleResult` in interface `javax.persistence.Query`

### setMaxResults

    public javax.persistence.Query setMaxResults(int maxResults)

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

### getMaxResults

    public int getMaxResults()

  Specified by:
    `getMaxResults` in interface `javax.persistence.Query`

### setFirstResult

    public javax.persistence.Query setFirstResult(int firstResult)

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

### getFirstResult

    public int getFirstResult()

  Specified by:
    `getFirstResult` in interface `javax.persistence.Query`

### 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

### executeUpdate

    public int executeUpdate()

  Specified by:
    `executeUpdate` in interface `javax.persistence.Query`

### setHint

    public javax.persistence.Query setHint(java.lang.String hintName,
                                           java.lang.Object value)

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

### getHints

    public java.util.Map<java.lang.String,java.lang.Object> getHints()

  Specified by:
    `getHints` in interface `javax.persistence.Query`

### setParameter

    public <T> javax.persistence.Query setParameter(javax.persistence.Parameter<T> tParameter,
                                                    T t)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(javax.persistence.Parameter<java.util.Calendar> calendarParameter,
                                                java.util.Calendar calendar,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(javax.persistence.Parameter<java.util.Date> dateParameter,
                                                java.util.Date date,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(java.lang.String name,
                                                java.lang.Object value)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(java.lang.String name,
                                                java.util.Date value,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(java.lang.String name,
                                                java.util.Calendar value,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(int position,
                                                java.lang.Object value)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(int position,
                                                java.util.Date value,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### getParameters

    public java.util.Set<javax.persistence.Parameter<?>> getParameters()

  Specified by:
    `getParameters` in interface `javax.persistence.Query`

### setParameter

    public javax.persistence.Query setParameter(int position,
                                                java.util.Calendar value,
                                                javax.persistence.TemporalType temporalType)

  Specified by:
    `setParameter` in interface `javax.persistence.Query`

### getParameter

    public javax.persistence.Parameter<?> getParameter(java.lang.String name)

  Specified by:
    `getParameter` in interface `javax.persistence.Query`

### getParameter

    public javax.persistence.Parameter<?> getParameter(int position)

  Specified by:
    `getParameter` in interface `javax.persistence.Query`

### getParameter

    public <T> javax.persistence.Parameter<T> getParameter(java.lang.String name,
                                                           java.lang.Class<T> type)

  Specified by:
    `getParameter` in interface `javax.persistence.Query`

### getParameter

    public <T> javax.persistence.Parameter<T> getParameter(int position,
                                                           java.lang.Class<T> type)

  Specified by:
    `getParameter` in interface `javax.persistence.Query`

### isBound

    public boolean isBound(javax.persistence.Parameter<?> param)

  Specified by:
    `isBound` in interface `javax.persistence.Query`

### getParameterValue

    public <T> T getParameterValue(javax.persistence.Parameter<T> param)

  Specified by:
    `getParameterValue` in interface `javax.persistence.Query`

### getParameterValue

    public java.lang.Object getParameterValue(java.lang.String name)

  Specified by:
    `getParameterValue` in interface `javax.persistence.Query`

### getParameterValue

    public java.lang.Object getParameterValue(int position)

  Specified by:
    `getParameterValue` in interface `javax.persistence.Query`

### setFlushMode

    public javax.persistence.Query setFlushMode(javax.persistence.FlushModeType flushMode)

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

### getFlushMode

    public javax.persistence.FlushModeType getFlushMode()

  Specified by:
    `getFlushMode` in interface `javax.persistence.Query`

### setLockMode

    public javax.persistence.Query setLockMode(javax.persistence.LockModeType lockModeType)

  Specified by:
    `setLockMode` in interface `javax.persistence.Query`

### getLockMode

    public javax.persistence.LockModeType getLockMode()

  Specified by:
    `getLockMode` in interface `javax.persistence.Query`

### unwrap

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

  Specified by:
    `unwrap` in interface `javax.persistence.Query`

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.