Class LuceneIndexSearcher

java.lang.Object
com.atlassian.jira.search.BaseIndexSearcher
com.atlassian.jira.search.lucene.LuceneIndexSearcher
All Implemented Interfaces:
IndexSearcher

@Internal public class LuceneIndexSearcher extends BaseIndexSearcher
A Lucene-based implementation of the IndexSearcher interface.
Since:
10.4
  • Constructor Details

  • Method Details

    • search

      public SearchResponse search(SearchRequest request, PageRequest pageRequest) throws SearchException
      Description copied from interface: IndexSearcher
      Retrieves a search response that includes a collection of document hits and aggregated results.

      By default, the hits are sorted in descending order of relevance score produced by the query ranking. The amount of hits returned is controlled by PageRequest.

      Parameters:
      request - request describing the query, optional sort order, fields to retrieve and aggregation request
      pageRequest - the page request
      Returns:
      SearchResponse containing the ordered list of document hits and any relevant aggregated data.
      Throws:
      SearchException
    • searchStream

      public SearchStreamResponse searchStream(SearchRequest request) throws SearchException
      Description copied from interface: IndexSearcher
      Retrieves a search response that provides streamable access to document hits and aggregated results.

      By default, the hits are sorted in descending order of relevance score produced by the query ranking.

      It is important to close the resulting response after use in order to clean up its resources. We recommend using try-with-resources.

      Performance note: this operation has an overhead over the normal search, so use it only when you specifically need to iterate through a large number of data, for example for data exports or migrations.

      Also consider a search with aggregations instead of computing it with this stream operation. Search aggregation API off-loads the computation to the search index, which is vastly more efficient than streaming all the documents, especially on OpenSearch.

      Sorting is not supported when streaming results and will result in a SearchException being thrown.

      Parameters:
      request - request describing the query, optional sort order, fields to retrieve and aggregation request
      Returns:
      SearchStreamResponse containing the ordered stream of document hits and any relevant aggregated data.
      Throws:
      SearchException
    • getHitCount

      public long getHitCount(SearchRequest request, @Nullable Long timeout) throws SearchException
      Description copied from interface: IndexSearcher
      Return the number of documents that match the request
      Parameters:
      request - request describing the query on which document should be counted
      timeout - request timeout in milliseconds, or null if no timeout
      Returns:
      the number of documents satisfying the query
      Throws:
      SearchException - if search requests takes longer than timeout