SearchResult

The hits of one KeyValueQuery or JsonPathQuery, read lazily page by page from one snapshot of the store (SPEC.md §4.6, §8, §10.4): the result sees every operation acknowledged before the search started and nothing later, so its pages together return every hit exactly once.

Hits can be read until the result is closed. A result is consumed once: nextPage, iterator and hits share one position. Not thread-safe.

Properties

Link copied to clipboard
abstract val hits: Flow<SearchHit>

The remaining hits as a flow. Collecting it reads the store on the collecting coroutine's thread, so collect on a dispatcher that allows blocking work.

Link copied to clipboard
abstract val snapshotLsn: Long

The snapshot the result reads, to correlate pages of different searches.

Functions

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract operator fun iterator(): Iterator<SearchHit>

The remaining hits across pages, in the query's order of (docId, nodePre).

Link copied to clipboard
abstract fun nextPage(): SearchPage?

The next page: at most the query's limit hits within its maxBytes; null when no hits are left.