CreationOptions

The options a store is created with, fixed for its whole life: they shape the stored data and the index terms. They are given to JsonStore.create and JsonStore.openOrCreate, recorded in the store, and read back by JsonStore.open, so opening a store never needs them; JsonStore.creationOptions tells what a store was created with. The options that may differ at every open are StoreOptions.

OptionDefaultRange
fragmentBytes64 KiB32 B … 16 MiB
hashTermstrue
indexedKeysempty (every key)
excludedKeysemptydisjoint from indexedKeys
minIndexedStringBytes0≥ 0
maxIndexedStringBytesunlimited≥ minIndexedStringBytes
normalizationNormalization.NONE
documentKeynonea JSON path other than $

Options are values: two instances with the same settings are equal, and copy derives a variant, such as CreationOptions().copy(normalization = Normalization.NFC).

  • fragmentBytes: target size T of the fragments a document is split into (SPEC.md §1). Values below 4 KiB are for testing. It also sets two limits (SPEC.md §1.3): a key is at most max(T/4, 64) UTF-8 bytes, and a number at most min(4096, max(T/4, 64)) characters, so a larger T allows longer keys and, up to a T of 16 KiB, longer numbers.

  • hashTerms: index whole object and array values, which searches for object and array literals need.

  • indexedKeys: when not empty, only members with these keys are indexed; excludedKeys: keys never indexed.

  • minIndexedStringBytes, maxIndexedStringBytes: UTF-8 lengths of the string values that are indexed. Numbers, booleans and null are always indexed. A search the controls leave unanswerable is rejected (SPEC.md §4.6); documents are stored and read back in full either way.

  • normalization: whether strings and keys are normalized to NFC as they are read (SPEC.md §2.1). With Normalization.NFC the normalized form is what is stored, indexed, compared and read back, and query keys, query values, type names and type paths are normalized the same way.

  • documentKey: the JSON path of the string that names each document (SPEC.md §3.3), set with withDocumentKey.

Constructors

Link copied to clipboard
constructor(fragmentBytes: Int = 64 * 1024, hashTerms: Boolean = true, indexedKeys: Set<String> = emptySet(), excludedKeys: Set<String> = emptySet(), minIndexedStringBytes: Int = 0, maxIndexedStringBytes: Int = Int.MAX_VALUE, normalization: Normalization = Normalization.NONE)

Options without a documentKey.

constructor(fragmentBytes: Int = 64 * 1024, hashTerms: Boolean = true, indexedKeys: Set<String> = emptySet(), excludedKeys: Set<String> = emptySet(), minIndexedStringBytes: Int = 0, maxIndexedStringBytes: Int = Int.MAX_VALUE, normalization: Normalization = Normalization.NONE, documentKey: String?)

Options with a documentKey; validated like the others.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The JSON path of the string member that names each document, or null for a store without document keys (SPEC.md §3.3): an RFC 9535 singular query without negative indexes, such as $.id or $['meta']['key'], as type paths are (SPEC.md §6.1), and not $ itself.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copy(fragmentBytes: Int = this.fragmentBytes, hashTerms: Boolean = this.hashTerms, indexedKeys: Set<String> = this.indexedKeys, excludedKeys: Set<String> = this.excludedKeys, minIndexedStringBytes: Int = this.minIndexedStringBytes, maxIndexedStringBytes: Int = this.maxIndexedStringBytes, normalization: Normalization = this.normalization): CreationOptions

These options with the given ones changed, the documentKey kept; 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
Link copied to clipboard

These options with documentKey set to path, or removed with null. Throws InvalidJsonPathException when path isn't a JSON path that can name a document's key.