Class ElasticsearchSearchQueryImpl<H>
- java.lang.Object
-
- org.hibernate.search.engine.search.query.spi.AbstractSearchQuery<H,ElasticsearchSearchResult<H>>
-
- org.hibernate.search.backend.elasticsearch.search.query.impl.ElasticsearchSearchQueryImpl<H>
-
- All Implemented Interfaces:
ElasticsearchSearchFetchable<H>,ElasticsearchSearchQuery<H>,ExtendedSearchFetchable<H,ElasticsearchSearchResult<H>,ElasticsearchSearchScroll<H>>,ExtendedSearchQuery<H,ElasticsearchSearchResult<H>,ElasticsearchSearchScroll<H>>,SearchFetchable<H>,SearchQuery<H>,SearchQueryImplementor<H>
public class ElasticsearchSearchQueryImpl<H> extends AbstractSearchQuery<H,ElasticsearchSearchResult<H>> implements ElasticsearchSearchQuery<H>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gson.JsonObjectexplain(Object id)Explain score computation of this query for the document with the given id.com.google.gson.JsonObjectexplain(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)ElasticsearchSearchResult<H>fetch(Integer offset, Integer limit)List<H>fetchHits(Integer offset, Integer limit)longfetchTotalHitCount()Execute the query and return the total hit count.StringqueryString()ElasticsearchSearchScroll<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,ElasticsearchSearchResult<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 ElasticsearchSearchResult<H> fetch(Integer offset, Integer limit)
Description copied from interface:SearchFetchable- Specified by:
fetchin interfaceExtendedSearchFetchable<H,ElasticsearchSearchResult<H>,ElasticsearchSearchScroll<H>>- Specified by:
fetchin interfaceSearchFetchable<H>- Specified by:
fetchin classAbstractSearchQuery<H,ElasticsearchSearchResult<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 ElasticsearchSearchScroll<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,ElasticsearchSearchResult<H>,ElasticsearchSearchScroll<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 com.google.gson.JsonObject explain(Object id)
Description copied from interface:ElasticsearchSearchQueryExplain score computation of this query for the document with the given id.This is a shorthand for
ElasticsearchSearchQuery.explain(String, Object)when the query only targets one index.- Specified by:
explainin interfaceElasticsearchSearchQuery<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:
- A
JsonObjectdescribing the score computation for the hit.
-
explain
public com.google.gson.JsonObject explain(String typeName, Object id)
Description copied from interface:ElasticsearchSearchQueryExplain 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 interfaceElasticsearchSearchQuery<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:
- A
JsonObjectdescribing the score computation for the hit.
-
failAfter
public void failAfter(long timeout, TimeUnit timeUnit)- Specified by:
failAfterin interfaceSearchQueryImplementor<H>
-
-