Skip to content

invertedIndex<R, K>(records, keysOf): InvertedIndex<K>

Defined in: packages/inverted-index/src/inverted-index.ts:187

Index records by the exact keys returned by keysOf(record, id). The selector is called once per record. Each iterable is consumed once. Keys use Map equality. Repeated keys on one record yield one posting. IDs denote positions in the input at build time. The index retains keys and IDs after construction.

Expected O(n + t) construction time for n records and t yielded keys, excluding the selector’s own work. With p distinct record/key associations and k distinct keys, both build workspace and retained storage are O(p + k). A single-key lookup costs expected O(1) plus O(1) per returned ID.

R

K

Iterable<R>

(record, id) => Iterable<K>

InvertedIndex<K>

With code MAX_CAPACITY_EXCEEDED when a record ID or the posting count exceeds 2³² − 1, or when the runtime rejects the key table or packed columns. Errors raised by input iterators and the selector propagate to the caller.