SearchHit

One hit: an object (CONTAINING_ELEMENT) or a document root (WHOLE_DOCUMENT). Readable while its result is open.

Properties

Link copied to clipboard
abstract val cursor: Cursor

Resume point strictly past this hit, in the query's order.

Link copied to clipboard
open val docId: DocId

The document the hit is in.

Link copied to clipboard

The key of the hit's document in a store with CreationOptions.documentKey, null in a store without one. Known already for a DocumentKeyQuery hit, and looked up in the key index when first read for others.

Link copied to clipboard
abstract val encodedSize: Long

Payload bytes that store the node, including the fragments it refers to, before compression. It predicts the size of the JSON output roughly, not exactly.

Link copied to clipboard
abstract val node: NodeRef

What the hit stands for: the containing object, or the document's root (SPEC.md §4.3).

Link copied to clipboard
abstract val path: String

Where node is in its document, as an RFC 9535 Normalized Path from the document root (SPEC.md §3.2): $['orders'][3], and $ for the root. Computed when first read: a JSONPath hit's is known already, a key–value hit's is found by reading the fragments from the root down to the node.

Link copied to clipboard
abstract val type: String?

The type of node as the result's snapshot sees it, or null.

Functions

Link copied to clipboard
open fun readJsonAsString(maxChars: Int): String

The node as a JSON string; throws ResultTooLargeException if it has more than maxChars characters.

abstract fun readJsonAsString(format: JsonFormat, maxChars: Int): String

The node as a JSON string laid out in format; throws ResultTooLargeException if the text has more than maxChars characters, its whitespace included.

Link copied to clipboard
open fun writeJsonTo(out: OutputStream)

Writes the node as JSON (SPEC.md §5) with memory independent of its size. Doesn't close out.

abstract fun writeJsonTo(out: OutputStream, format: JsonFormat)

Writes the node as JSON laid out in format (SPEC.md §5.1) with memory independent of its size. Doesn't close out.