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 Details

    • fetch

      SearchResult<H> fetch(Integer limit)
      Execute the query and return the SearchResult, limiting to limit hits.
      Parameters:
      limit - The maximum number of hits to be included in the SearchResult. null means no limit.
      Returns:
      The SearchResult.
      Throws:
      SearchException - If something goes wrong while executing the query.
      SearchTimeoutException - If a failure 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

      SearchResult<H> fetch(Integer offset, Integer limit)
      Execute the query and return the SearchResult, skipping offset hits and limiting to limit hits.
      Parameters:
      offset - The number of hits to skip before adding the hits to the SearchResult. null means no offset.
      limit - The maximum number of hits to be included in the SearchResult. null means no limit.
      Returns:
      The SearchResult.
      Throws:
      SearchException - If something goes wrong while executing the query.
      SearchTimeoutException - If a failure 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

      List<H> fetchHits(Integer limit)
      Execute the query and return the hits as a List, limiting to limit 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 a failure 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

      List<H> fetchHits(Integer offset, Integer limit)
      Execute the query and return the hits as a List, skipping offset hits and limiting to limit hits.
      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 a failure 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

      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 a failure 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 a failure timeout was set and was reached while executing the query.
    • fetchAll

      SearchResult<H> fetchAll()
      Execute the query and return the SearchResult, including all hits, without any sort of limit.

      fetch(Integer) or fetch(Integer, Integer) should generally be preferred, for performance reasons.

      Returns:
      The SearchResult.
      Throws:
      SearchException - If something goes wrong while executing the query.
      SearchTimeoutException - If a failure 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

      List<H> fetchAllHits()
      Execute the query and return all hits as a List, without any sort of limit.

      fetchHits(Integer) or fetchHits(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 a failure 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

      SearchScroll<H> scroll(int chunkSize)
      Execute the query continuously to deliver results in small chunks through a SearchScroll.

      Useful to process large datasets.

      Parameters:
      chunkSize - The maximum number of hits to be returned for each call to SearchScroll.next()
      Returns:
      The SearchScroll.
      Throws:
      IllegalArgumentException - if passed 0 or less for chunkSize.