Interface SearchFetchable<H>
- Type Parameters:
H
- The type of query hits.
- All Known Subinterfaces:
ElasticsearchSearchFetchable<H>
,ElasticsearchSearchQuery<H>
,ElasticsearchSearchQueryOptionsStep<H,
,LOS> ExtendedSearchFetchable<H,
,R, SC> ExtendedSearchQuery<H,
,R, SC> LuceneSearchFetchable<H>
,LuceneSearchQuery<H>
,LuceneSearchQueryOptionsStep<H,
,LOS> 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
Modifier and TypeMethodDescriptionExecute the query and return theSearchResult
, limiting tolimit
hits.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 tolimit
hits.Execute the query and return the hits as a single, optional element.long
Execute 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 tolimit
hits.- Parameters:
limit
- The maximum number of hits to be included in theSearchResult
.null
means no limit.- Returns:
- The
SearchResult
. - Throws:
SearchException
- If something goes wrong while executing the query.SearchTimeoutException
- If afailure timeout was set
and 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
.null
means no offset.limit
- The maximum number of hits to be included in theSearchResult
.null
means no limit.- Returns:
- The
SearchResult
. - Throws:
SearchException
- If something goes wrong while executing the query.SearchTimeoutException
- If afailure timeout was set
and 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 tolimit
hits.- Parameters:
limit
- The maximum number of hits to be returned by this method.null
means no limit.- Returns:
- The query hits.
- Throws:
SearchException
- If something goes wrong while executing the query.SearchTimeoutException
- If afailure timeout was set
and 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.null
means no offset.limit
- The maximum number of hits to be returned by this method.null
means no limit.- Returns:
- The query hits.
- Throws:
SearchException
- If something goes wrong while executing the query.SearchTimeoutException
- If afailure timeout was set
and 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:
SearchException
- If something goes wrong while executing the query, or the number of hits is more than one.SearchTimeoutException
- If afailure timeout was set
and 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 set
and 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 set
and 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:
SearchException
- If something goes wrong while executing the query.SearchTimeoutException
- If afailure timeout was set
and 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
.
-