Class LuceneSearchQueryImpl<H>
- java.lang.Object
-
- org.hibernate.search.engine.search.query.spi.AbstractSearchQuery<H,LuceneSearchResult<H>>
-
- org.hibernate.search.backend.lucene.search.query.impl.LuceneSearchQueryImpl<H>
-
- All Implemented Interfaces:
LuceneSearchFetchable<H>,LuceneSearchQuery<H>,ExtendedSearchFetchable<H,LuceneSearchResult<H>,LuceneSearchScroll<H>>,ExtendedSearchQuery<H,LuceneSearchResult<H>,LuceneSearchScroll<H>>,SearchFetchable<H>,SearchQuery<H>,SearchQueryImplementor<H>
public class LuceneSearchQueryImpl<H> extends AbstractSearchQuery<H,LuceneSearchResult<H>> implements LuceneSearchQuery<H>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.search.Explanationexplain(Object id)Explain score computation of this query for the document with the given id.org.apache.lucene.search.Explanationexplain(String typeName, Object id)Explain score computation of this query for the document with the given id in the given mapped type.<Q> Qextension(SearchQueryExtension<Q,H> extension)Extend the current query with the given extension, resulting in an extended query offering more options or a more detailed result type.voidfailAfter(long timeout, TimeUnit timeUnit)LuceneSearchResult<H>fetch(Integer offset, Integer limit)List<H>fetchHits(Integer offset, Integer limit)longfetchTotalHitCount()Execute the query and return the total hit count.org.apache.lucene.search.SortluceneSort()StringqueryString()LuceneSearchScroll<H>scroll(int chunkSize)Execute the query continuously to deliver results in small chunks through aSearchScroll.StringtoString()-
Methods inherited from class org.hibernate.search.engine.search.query.spi.AbstractSearchQuery
fetch, fetchAll, fetchAllHits, fetchHits, fetchSingleHit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.search.engine.search.query.ExtendedSearchFetchable
fetch, fetchAll
-
Methods inherited from interface org.hibernate.search.engine.search.query.SearchFetchable
fetchAllHits, fetchHits, fetchSingleHit
-
-
-
-
Method Detail
-
queryString
public String queryString()
- Specified by:
queryStringin interfaceSearchQuery<H>- Returns:
- A textual representation of the query.
-
toString
public String toString()
- Overrides:
toStringin classAbstractSearchQuery<H,LuceneSearchResult<H>>
-
extension
public <Q> Q extension(SearchQueryExtension<Q,H> extension)
Description copied from interface:SearchQueryExtend the current query with the given extension, resulting in an extended query offering more options or a more detailed result type.- Specified by:
extensionin interfaceSearchQuery<H>- Type Parameters:
Q- The type of queries provided by the extension.- Parameters:
extension- The extension to the predicate DSL.- Returns:
- The extended query.
-
fetch
public LuceneSearchResult<H> fetch(Integer offset, Integer limit)
Description copied from interface:SearchFetchable- Specified by:
fetchin interfaceExtendedSearchFetchable<H,LuceneSearchResult<H>,LuceneSearchScroll<H>>- Specified by:
fetchin interfaceSearchFetchable<H>- Specified by:
fetchin classAbstractSearchQuery<H,LuceneSearchResult<H>>- Parameters:
offset- The number of hits to skip before adding the hits to theSearchResult.nullmeans no offset.limit- The maximum number of hits to be included in theSearchResult.nullmeans no limit.- Returns:
- The
SearchResult.
-
fetchHits
public List<H> fetchHits(Integer offset, Integer limit)
Description copied from interface:SearchFetchable- Specified by:
fetchHitsin interfaceSearchFetchable<H>- Parameters:
offset- The number of hits to skip.nullmeans no offset.limit- The maximum number of hits to be returned by this method.nullmeans no limit.- Returns:
- The query hits.
-
fetchTotalHitCount
public long fetchTotalHitCount()
Description copied from interface:SearchFetchableExecute the query and return the total hit count.- Specified by:
fetchTotalHitCountin interfaceSearchFetchable<H>- Returns:
- The total number of matching entities, ignoring pagination settings.
-
scroll
public LuceneSearchScroll<H> scroll(int chunkSize)
Description copied from interface:SearchFetchableExecute the query continuously to deliver results in small chunks through aSearchScroll.Useful to process large datasets.
- Specified by:
scrollin interfaceExtendedSearchFetchable<H,LuceneSearchResult<H>,LuceneSearchScroll<H>>- Specified by:
scrollin interfaceSearchFetchable<H>- Parameters:
chunkSize- The maximum number of hits to be returned for each call toSearchScroll.next()- Returns:
- The
SearchScroll.
-
explain
public org.apache.lucene.search.Explanation explain(Object id)
Description copied from interface:LuceneSearchQueryExplain score computation of this query for the document with the given id.This is a shorthand for
LuceneSearchQuery.explain(String, Object)when the query only targets one mapped type.- Specified by:
explainin interfaceLuceneSearchQuery<H>- Parameters:
id- The id of the entity whose score should be explained. This is the entity ID, which may be of any type (long, ...), not the document ID which is always a string.- Returns:
- An
Explanationdescribing the score computation for the hit.
-
explain
public org.apache.lucene.search.Explanation explain(String typeName, Object id)
Description copied from interface:LuceneSearchQueryExplain score computation of this query for the document with the given id in the given mapped type.This feature is relatively expensive, use it only sparingly and when you need to debug a slow query.
- Specified by:
explainin interfaceLuceneSearchQuery<H>- Parameters:
typeName- The name of the type of the entity whose score should be explained.id- The id of the entity whose score should be explained. This is the entity ID, which may be of any type (long, ...), not the document ID which is always a string.- Returns:
- An
Explanationdescribing the score computation for the hit.
-
luceneSort
public org.apache.lucene.search.Sort luceneSort()
- Specified by:
luceneSortin interfaceLuceneSearchQuery<H>- Returns:
- The Lucene
Sortthis query relies on.
-
failAfter
public void failAfter(long timeout, TimeUnit timeUnit)- Specified by:
failAfterin interfaceSearchQueryImplementor<H>
-
-