Class LuceneIndexSearcher
- All Implemented Interfaces:
IndexSearcher
IndexSearcher interface.- Since:
- 10.4
-
Field Summary
Fields inherited from class com.atlassian.jira.search.BaseIndexSearcher
searchLimits -
Constructor Summary
ConstructorsConstructorDescriptionLuceneIndexSearcher(LuceneQueryMapper<Query> queryMapper, IndexSearcherProvider indexSearcherProvider, LuceneSortMapper sortMapper, LuceneAggregatorFactory aggregatorFactory, IssueSearchLimits searchLimits, LuceneSearchMemoryCircuitBreaker luceneSearchMemoryCircuitBreaker) -
Method Summary
Modifier and TypeMethodDescriptionlonggetHitCount(SearchRequest request, Long timeout) Return the number of documents that match the requestsearch(SearchRequest request, PageRequest pageRequest) Retrieves a search response that includes a collection of document hits and aggregated results.searchStream(SearchRequest request) Retrieves a search response that provides streamable access to document hits and aggregated results.Methods inherited from class com.atlassian.jira.search.BaseIndexSearcher
ensureSearchRequestWithinLimits, ensureSearchRequestWithinLimits
-
Constructor Details
-
LuceneIndexSearcher
public LuceneIndexSearcher(LuceneQueryMapper<Query> queryMapper, IndexSearcherProvider indexSearcherProvider, LuceneSortMapper sortMapper, LuceneAggregatorFactory aggregatorFactory, IssueSearchLimits searchLimits, LuceneSearchMemoryCircuitBreaker luceneSearchMemoryCircuitBreaker)
-
-
Method Details
-
search
Description copied from interface:IndexSearcherRetrieves 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 requestpageRequest- the page request- Returns:
SearchResponsecontaining the ordered list of document hits and any relevant aggregated data.- Throws:
SearchException
-
searchStream
Description copied from interface:IndexSearcherRetrieves 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
closethe 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
searchwithaggregationsinstead 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
SearchExceptionbeing thrown.- Parameters:
request- request describing the query, optional sort order, fields to retrieve and aggregation request- Returns:
SearchStreamResponsecontaining the ordered stream of document hits and any relevant aggregated data.- Throws:
SearchException
-
getHitCount
Description copied from interface:IndexSearcherReturn the number of documents that match the request- Parameters:
request- request describing the query on which document should be countedtimeout- 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
-