Interface SearchResponse

All Known Implementing Classes:
SearchResponseImpl

public interface SearchResponse
Since:
2025.0
  • Method Details

    • getTotal

      long getTotal()
      Get the total number of match for the query. Limit is not taken in account.
      Returns:
      -1 if unknown.
    • isTotalAccurate

      boolean isTotalAccurate()
      Returns true if the total is accurate, i.e. not an estimation.
    • getHitsCount

      long getHitsCount()
      Returns the number of returned search hits, taking in account limits.
    • getHits

      List<SearchHit> getHits()
      Returns the search hits.
    • getHitsAsMap

      Returns search hits as a partial list.
    • getHitsAsIterator

      IterableQueryResult getHitsAsIterator()
      Returns search hits as an iterator, the query must be a scroll query.
      Throws:
      IllegalArgumentException - if the query is not of scroll type.
    • isMissingCapabilities

      default boolean isMissingCapabilities()
      Returns true if the response is provided but search client lacks some search capabilities.
    • getMissingCapabilities

      List<SearchClient.Capability> getMissingCapabilities()
      Returns the list of SearchClient.Capability that are missing to fully perform the SearchQuery.
    • getScrollContext

      @Nullable SearchScrollContext getScrollContext()
      Returns a scroll context to use in SearchService.searchScroll(SearchScrollContext) to fetch the next batch of results.
    • getAggregates

      List<Aggregate<? extends Bucket>> getAggregates()
      Returns the aggregates.
    • loadDocuments

      DocumentModelList loadDocuments(CoreSession defaultSession)
      Loads search hits from repository as a DocumentModelList using the provided session. Can be an expensive operation. In the case of a multi repository search, additional sessions are created using the defaultSession principal.
    • builder

      static SearchResponseImpl.Builder builder(List<SearchHit> hits)
      Returns:
      a SearchResponse builder.