search

open fun search(query: Query, n: Int): TopDocs

Finds the top n hits for query.

Throws

If a query would exceed IndexSearcher.getMaxClauseCount clauses.


fun search(query: Query, n: Int, sort: Sort, doDocScores: Boolean): TopFieldDocs

Search implementation with arbitrary sorting, plus control over whether hit scores and max score should be computed. Finds the top n hits for query, and sorting the hits by the criteria in sort. If doDocScores is true then the score of each hit will be computed and returned. If doMaxScore is true then the maximum score over all collected hits will be computed.

Throws

If a query would exceed IndexSearcher.getMaxClauseCount clauses.


open fun search(query: Query, n: Int, sort: Sort): TopFieldDocs

Search implementation with arbitrary sorting.

Return

The top docs, sorted according to the supplied Sort instance

Parameters

query

The query to search for

n

Return only the top n results

sort

The Sort object

Throws

IOException

if there is a low-level I/O error


open fun <C : Collector, T> search(query: Query, collectorManager: CollectorManager<C, T>): T

Lower-level search API. Search all leaves using the given CollectorManager. In contrast to .search, this method will use the searcher's Executor in order to parallelize execution of the collection on the configured .getSlices.

See also


open fun search(query: Query, collector: Collector)

Deprecated

This method is being deprecated in favor of {@link IndexSearcher#search(Query, * CollectorManager)} due to its support for concurrency in IndexSearcher

Lower-level search API.

LeafCollector.collect is called for every matching document.

Throws

If a query would exceed IndexSearcher.getMaxClauseCount clauses.