Save This Page
Home » hibernate-search-src-20081106 » org.hibernate » search » [javadoc | source]
org.hibernate.search
public interface: FullTextQuery [javadoc | source]

All Implemented Interfaces:
    ProjectionConstants, org.hibernate.Query

All Known Implementing Classes:
    FullTextQueryImpl

The base interface for lucene powered searches.
Method from org.hibernate.search.FullTextQuery Summary:
disableFullTextFilter,   enableFullTextFilter,   explain,   getResultSize,   setCriteriaQuery,   setFetchSize,   setFilter,   setFirstResult,   setMaxResults,   setProjection,   setResultTransformer,   setSort
Method from org.hibernate.search.FullTextQuery Detail:
 public  void disableFullTextFilter(String name)
    Disable a given filter by its name
 public FullTextFilter enableFullTextFilter(String name)
    Enable a given filter by its name. Returns a FullTextFilter object that allows filter parameter injection
 public Explanation explain(int documentId)
 public 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.

 public FullTextQuery setCriteriaQuery(Criteria criteria)
    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.

 public FullTextQuery setFetchSize(int i)
    Defines scrollable result fetch size as well as the JDBC fetch size
 public FullTextQuery setFilter(Filter filter)
    Allows to use lucene filters. Semi-deprecated? a preferred way is to use the @FullTextFilterDef approach
 public FullTextQuery setFirstResult(int firstResult)
    {link:Query#setFirstResult}
 public FullTextQuery setMaxResults(int maxResults)
    {link:Query#setMaxResults}
 public 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).

    A projectable field must be stored in the Lucene index and use a org.hibernate.search.bridge.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[]

 public FullTextQuery setResultTransformer(ResultTransformer transformer)
    defines a result transformer used during projection, the Aliases provided are the projection aliases.
 public FullTextQuery setSort(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.