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<SR,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
Modifier and TypeMethodDescriptionExecute the query and return theSearchResult, limiting tolimithits.fetchAll()Execute the query and return theSearchResult, including all hits, without any sort of limit.Execute the query and return all hits as aList, without any sort of limit.Execute the query and return the hits as aList, limiting tolimithits.Execute the query and return the hits as a single, optional element.longExecute the query and return the total hit count.scroll(int chunkSize) Execute the query continuously to deliver results in small chunks through aSearchScroll.
-
Method Details
-
fetch
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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
- 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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
- 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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
Execute the query and return the hits as a single, optional element.- Returns:
- The single, optional query hit.
- Throws:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query, or the number of hits is more than one.org.hibernate.search.util.common.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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
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:
org.hibernate.search.util.common.SearchException- If something goes wrong while executing the query.org.hibernate.search.util.common.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
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.
-