com.mysema.query.hibernate.search
Class SearchQuery<T>

java.lang.Object
  extended by com.mysema.query.hibernate.search.SearchQuery<T>
Type Parameters:
T -
All Implemented Interfaces:
FilteredClause<SearchQuery<T>>, SimpleProjectable<T>, SimpleQuery<SearchQuery<T>>

public class SearchQuery<T>
extends Object
implements SimpleQuery<SearchQuery<T>>, SimpleProjectable<T>

SearchQuery is a Query implementation for Hibernate Search

Author:
tiwe

Constructor Summary
SearchQuery(org.hibernate.search.FullTextSession session, EntityPath<T> path)
           
SearchQuery(org.hibernate.Session session, EntityPath<T> path)
           
 
Method Summary
 long count()
          Get the count of matched elements
 long countDistinct()
          Get the count of distinct matched elements
 SearchQuery<T> distinct()
          Set the Query to return distinct results
 boolean exists()
           
 com.mysema.commons.lang.CloseableIterator<T> iterate()
          Get the projection as a typed closeable Iterator
 com.mysema.commons.lang.CloseableIterator<T> iterateDistinct()
          Get the projection as a typed closeable Iterator with distinct elements
 SearchQuery<T> limit(long limit)
          Defines the limit / max results for the query results
 List<T> list()
          Get the projection as a typed List
 List<T> listDistinct()
          Get the projection as a typed List with distinct elements
 SearchResults<T> listDistinctResults()
          Get the projection in SearchResults form with distinct element
 SearchResults<T> listResults()
          Get the projection in SearchResults form
 boolean notExists()
           
 SearchQuery<T> offset(long offset)
          Defines the offset for the query results
 SearchQuery<T> orderBy(OrderSpecifier<?>... o)
          Defines the order expressions
 SearchQuery<T> restrict(QueryModifiers modifiers)
          Defines both limit and offset of the query results
<P> SearchQuery<T>
set(ParamExpression<P> param, P value)
          Set the given parameter to the given value
 T singleResult()
          Get the projection as a single result or null if no result is found
 T uniqueResult()
          Get the projection as a unique result or null if no result is found
 SearchQuery<T> where(Predicate... e)
          Adds the given filter conditions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchQuery

public SearchQuery(org.hibernate.search.FullTextSession session,
                   EntityPath<T> path)

SearchQuery

public SearchQuery(org.hibernate.Session session,
                   EntityPath<T> path)
Method Detail

exists

public boolean exists()
Specified by:
exists in interface SimpleProjectable<T>
Returns:
true, if rows matching the given criteria exist, otherwise false

notExists

public boolean notExists()
Specified by:
notExists in interface SimpleProjectable<T>
Returns:
true, if no rows matching the given criteria exist, otherwise false

count

public long count()
Description copied from interface: SimpleProjectable
Get the count of matched elements

Specified by:
count in interface SimpleProjectable<T>
Returns:

countDistinct

public long countDistinct()
Description copied from interface: SimpleProjectable
Get the count of distinct matched elements

Specified by:
countDistinct in interface SimpleProjectable<T>
Returns:

distinct

public SearchQuery<T> distinct()
Description copied from interface: SimpleQuery
Set the Query to return distinct results

Specified by:
distinct in interface SimpleQuery<SearchQuery<T>>
Returns:

iterate

public com.mysema.commons.lang.CloseableIterator<T> iterate()
Description copied from interface: SimpleProjectable
Get the projection as a typed closeable Iterator

Specified by:
iterate in interface SimpleProjectable<T>
Returns:

iterateDistinct

public com.mysema.commons.lang.CloseableIterator<T> iterateDistinct()
Description copied from interface: SimpleProjectable
Get the projection as a typed closeable Iterator with distinct elements

Specified by:
iterateDistinct in interface SimpleProjectable<T>
Returns:

limit

public SearchQuery<T> limit(long limit)
Description copied from interface: SimpleQuery
Defines the limit / max results for the query results

Specified by:
limit in interface SimpleQuery<SearchQuery<T>>
Returns:

list

public List<T> list()
Description copied from interface: SimpleProjectable
Get the projection as a typed List

Specified by:
list in interface SimpleProjectable<T>
Returns:

listDistinct

public List<T> listDistinct()
Description copied from interface: SimpleProjectable
Get the projection as a typed List with distinct elements

Specified by:
listDistinct in interface SimpleProjectable<T>
Returns:

listDistinctResults

public SearchResults<T> listDistinctResults()
Description copied from interface: SimpleProjectable
Get the projection in SearchResults form with distinct element

Specified by:
listDistinctResults in interface SimpleProjectable<T>
Returns:

listResults

public SearchResults<T> listResults()
Description copied from interface: SimpleProjectable
Get the projection in SearchResults form

Specified by:
listResults in interface SimpleProjectable<T>
Returns:

offset

public SearchQuery<T> offset(long offset)
Description copied from interface: SimpleQuery
Defines the offset for the query results

Specified by:
offset in interface SimpleQuery<SearchQuery<T>>
Returns:

orderBy

public SearchQuery<T> orderBy(OrderSpecifier<?>... o)
Description copied from interface: SimpleQuery
Defines the order expressions

Specified by:
orderBy in interface SimpleQuery<SearchQuery<T>>
Returns:

restrict

public SearchQuery<T> restrict(QueryModifiers modifiers)
Description copied from interface: SimpleQuery
Defines both limit and offset of the query results

Specified by:
restrict in interface SimpleQuery<SearchQuery<T>>
Returns:

set

public <P> SearchQuery<T> set(ParamExpression<P> param,
                              P value)
Description copied from interface: SimpleQuery
Set the given parameter to the given value

Specified by:
set in interface SimpleQuery<SearchQuery<T>>
Returns:

singleResult

public T singleResult()
Description copied from interface: SimpleProjectable
Get the projection as a single result or null if no result is found

for multiple results only the first one is returned

Specified by:
singleResult in interface SimpleProjectable<T>
Returns:

uniqueResult

public T uniqueResult()
Description copied from interface: SimpleProjectable
Get the projection as a unique result or null if no result is found

Specified by:
uniqueResult in interface SimpleProjectable<T>
Returns:

where

public SearchQuery<T> where(Predicate... e)
Description copied from interface: FilteredClause
Adds the given filter conditions

Specified by:
where in interface FilteredClause<SearchQuery<T>>
Parameters:
e - filter conditions to be added
Returns:


Copyright © 2007-2012 Mysema Ltd. All Rights Reserved.