KeyValueQuery

class KeyValueQuery(val key: String, val value: JsonQueryValue, val mode: ResultMode = ResultMode.WHOLE_DOCUMENT, val nested: NestedHits = NestedHits.ALL, val limit: Int = 100, val maxBytes: Long = Long.MAX_VALUE, val after: Cursor? = null, val type: String? = null, val order: SearchOrder = SearchOrder.ASCENDING)(source)

A key–value search (SPEC.md §4): objects with a member key whose value, or an element of whose array value, equals value.

  • mode: ResultMode.WHOLE_DOCUMENT (the default) makes each matching document a hit, with the root as the hit's node; ResultMode.CONTAINING_ELEMENT each object that contains a match.

  • nested: with NestedHits.OUTERMOST_ONLY, a containing object inside another containing object of the same document is dropped.

  • limit: at most this many hits per page.

  • maxBytes: a page also ends before a hit that would take the sum of the page's SearchHit.encodedSizes above this; a page always holds at least one hit. Long.MAX_VALUE means no byte budget.

  • after: resume strictly past this cursor's (docId, nodePre) in order. A cursor from a search of the other order, or from a TypePage, is refused with InvalidCursorException.

  • type: only containing objects of this type match (SPEC.md §6.2); in WHOLE_DOCUMENT mode a document is a hit when one of its objects of this type contains a match. A search with an invalid name throws InvalidTypeNameException.

  • order: the order of the hits (SPEC.md §4.4). SearchOrder.DESCENDING with limit = 1 gives the newest hit.

Queries are values: two instances with the same settings are equal, and copy derives a variant.

Constructors

Link copied to clipboard
constructor(key: String, value: JsonQueryValue, mode: ResultMode = ResultMode.WHOLE_DOCUMENT, nested: NestedHits = NestedHits.ALL, limit: Int = 100, maxBytes: Long = Long.MAX_VALUE, after: Cursor? = null, type: String? = null, order: SearchOrder = SearchOrder.ASCENDING)

Properties

Link copied to clipboard
Link copied to clipboard
val key: String
Link copied to clipboard
val limit: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val type: String?
Link copied to clipboard

Functions

Link copied to clipboard
fun copy(key: String = this.key, value: JsonQueryValue = this.value, mode: ResultMode = this.mode, nested: NestedHits = this.nested, limit: Int = this.limit, maxBytes: Long = this.maxBytes, after: Cursor? = this.after, type: String? = this.type, order: SearchOrder = this.order): KeyValueQuery

This query with the given settings changed; the result is validated like a new instance.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String