Interface SearchFetchable<H>
-
- Type Parameters:
H- The type of query hits.
- All Known Subinterfaces:
ExtendedSearchFetchable<H,R,SC>,ExtendedSearchQuery<H,R,SC>,SearchQuery<H>,SearchQueryFinalStep<H>,SearchQueryImplementor<H>,SearchQueryOptionsStep<S,H,LOS,SF,AF>
- All Known Implementing Classes:
AbstractExtendedSearchQueryOptionsStep,AbstractSearchQuery,AbstractSearchQueryOptionsStep
public interface SearchFetchable<H>A component allowing to fetch search results.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SearchResult<H>fetch(Integer limit)Execute the query and return theSearchResult, limiting tolimithits.SearchResult<H>fetch(Integer offset, Integer limit)SearchResult<H>fetchAll()Execute the query and return theSearchResult, including all hits, without any sort of limit.List<H>fetchAllHits()Execute the query and return all hits as aList, without any sort of limit.List<H>fetchHits(Integer limit)Execute the query and return the hits as aList, limiting tolimithits.List<H>fetchHits(Integer offset, Integer limit)Optional<H>fetchSingleHit()Execute the query and return the hits as a single, optional element.longfetchTotalHitCount()Execute the query and return the total hit count.SearchScroll<H>scroll(int chunkSize)Execute the query continuously to deliver results in small chunks through aSearchScroll.
-
-
-
Method Detail
-
fetch
SearchResult<H> fetch(Integer limit)
Execute the query and return theSearchResult, limiting tolimithits.- Parameters:
limit- The maximum number of hits to be included in theSearchResult.nullmeans no limit.- Returns:
- The
SearchResult. - Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetch
SearchResult<H> fetch(Integer offset, Integer limit)
- 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. - Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetchHits
List<H> fetchHits(Integer limit)
Execute the query and return the hits as aList, limiting tolimithits.- Parameters:
limit- The maximum number of hits to be returned by this method.nullmeans no limit.- Returns:
- The query hits.
- Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetchHits
List<H> fetchHits(Integer offset, Integer limit)
- 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.
- Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetchSingleHit
Optional<H> fetchSingleHit()
Execute the query and return the hits as a single, optional element.- Returns:
- The single, optional query hit.
- Throws:
SearchException- If something goes wrong while executing the query, or the number of hits is more than one.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetchTotalHitCount
long fetchTotalHitCount()
Execute the query and return the total hit count.- Returns:
- The total number of matching entities, ignoring pagination settings.
- Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.
-
fetchAll
SearchResult<H> fetchAll()
Execute the query and return theSearchResult, including all hits, without any sort of limit.fetch(Integer)orfetch(Integer, Integer)should generally be preferred, for performance reasons.- Returns:
- The
SearchResult. - Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
fetchAllHits
List<H> fetchAllHits()
Execute the query and return all hits as aList, without any sort of limit.fetchHits(Integer)orfetchHits(Integer, Integer)should generally be preferred, for performance reasons.- Returns:
- The query hits.
- Throws:
SearchException- If something goes wrong while executing the query.SearchTimeoutException- If afailure timeout was setand was reached while executing the query.RuntimeException- If something goes wrong while loading entities. The exact type depends on the mapper, e.g. HibernateException/PersistenceException for the Hibernate ORM mapper.
-
scroll
SearchScroll<H> scroll(int chunkSize)
Execute the query continuously to deliver results in small chunks through aSearchScroll.Useful to process large datasets.
- Parameters:
chunkSize- The maximum number of hits to be returned for each call toSearchScroll.next()- Returns:
- The
SearchScroll. - Throws:
IllegalArgumentException- if passed 0 or less forchunkSize.
-
-