Class ExitableLuceneIndexSearcher
- All Implemented Interfaces:
IndexSearcher
LuceneIndexSearcher that allows to enforce JQL query time limits
via QueryTimeoutContext which can optionally be set as Jira application property.-
Field Summary
Fields -
Constructor Summary
Constructors -
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.
-
Field Details
-
TIMEOUT_EXCEPTION_CUSTOMER_VISIBLE_TEXT
- See Also:
-
-
Constructor Details
-
ExitableLuceneIndexSearcher
-
-
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.- Specified by:
searchin interfaceIndexSearcher- 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.- Specified by:
searchStreamin interfaceIndexSearcher- 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- Specified by:
getHitCountin interfaceIndexSearcher- 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
-