search

abstract fun search(query: KeyValueQuery): SearchResult(source)

Starts a search on the current state, reading on the caller's thread; close the result when done. A search the index controls of CreationOptions leave unanswerable throws QueryRejectedException with QueryRejectedException.Reason.NOT_INDEXED (SPEC.md §4.1).


abstract fun search(query: JsonPathQuery): SearchResult(source)

Starts a JSONPath search on the current state (SPEC.md §10.4): the distinct nodes the query selects from every document, in the query's order of (docId, nodePre). Close the result when done.

The index narrows the documents down by the terms the query requires (explain); a query that requires none throws QueryRejectedException unless JsonPathQuery.scan allows reading every document, as does a range that matches too many documents, and a query of more than 31 segments.


Starts a search of documents in key order (SPEC.md §3.3) on the current state; close the result when done. A store without document keys throws IllegalStateException.


The k visible documents whose vectors are nearest to the query vector, on the current state (SPEC.md §11.3): an exact search, which compares every candidate's vector before it returns. Close the result when done; its hits' documents are read when a hit is read. Cancelling the call stops the search within a few hundred vectors or candidates read.

Throws IllegalStateException in a store without a CreationOptions.vectorField, IllegalArgumentException for a query vector of other dimensions or, under VectorMetric.COSINE, a zero one, and QueryRejectedException when the query's document filter names no index term and the query doesn't allow a scan.