import * as usearch from 'usearch';import { DenseVectors } from 'usearch';import { DenseCursorLinks } from 'usearch';import { DenseDraws } from 'usearch';import { DenseCursorBatch } from 'usearch';import { DenseCursor } from 'usearch';import { DenseSearchStream } from 'usearch';3.0.0-rc.1 · 4c3e5023
get exports the vectors stored under one key into the arena, as f32 unless scalar names another kind:
const stored = index.get(42n, arena); // The vectors under a key, as f32 DenseVectorsusing bitsArena = new usearch.Arena();const packed = index.get(42n, bitsArena, { scalar: usearch.Scalar.U1x8 }); // Or as packed bits, in another arena
get shapes its rows from the width and stride the call reports: stored.data holds stored.rows rows of stored.columns values, stored.stride bytes apart, and no rows when the key is absent.
A cursor walks the index instead; each shard’s watermark is read as the walk enters it, so an entry once passed is never revisited.
Without start keys it yields every entry in storage order; with them, the starts’ own entries first, then the entries those link to breadth-first, each once.
It lands each batch of up to wanted keys in the arena, and beside them the keys each links to when links asks; the vectors themselves come from get:
Cursors and streams keep their walk state rather than a thread: every pull is an ordinary call on the executor of the receiver that opened them, and each keeps its index alive until freed.
No residency implements the stream yet, so the engine answers Status.Unsupported, and a stream reports no telemetry, since the ABI gives a resumable walk none.
sample draws keys around focus, or across the whole index, each hanging from a shown or earlier draw and placed in three dimensions beside the shown keys already on screen, so a view grows one connected sample as it zooms.
Equal seeds, shown keys and focus draw equally, and a larger wanted draws a superset.
The shown keys, their coordinates and the focus are read in place, so a deferred sample holds those arrays until it is final.
const drawn = index.on(executor).sample(256, arena, { shown, shownCoordinates: places, focus: near, seed: 42 });drawn.keys; // sixteen bytes per drawdrawn.entryOrdinals; // which of its key's entries each draw isdrawn.parents.get(0); // the shown or earlier draw it hangs from, empty for a rootdrawn.coordinates.data; // three f32 values per draw
API
Types
DenseSampleConfigOptional per-call settings of a sample; absent ones draw across the whole index with nothing shown.
data is a Float64Array, Float32Array, Float16Array or Int8Array for the kinds
JavaScript spells, a Uint16Array for bf16 and for f16 on a runtime without Float16Array,
and the raw bytes in a Uint8Array for the rest.
ClassDenseCursorLinksThe keys each entry of a cursor pull links to, as a ragged run with Apache Arrow offsets: entry i links to keys offsets[i] up to offsets[i + 1].5
ClassDenseDrawsThe draws a sample wrote, viewed inside its arena: each draw's key, which of that key's entries it is, the shown or earlier draw it hangs from, and where it is placed.6
Each shard's publication watermark is read as the walk enters it, so an entry once passed is never revisited.
Holds engine state until free is called; a walk left to the garbage collector releases it
whenever the collector gets to it. It keeps its index alive, and pulls on the executor of the
receiver that opened it.
This is the filtered path: pull matches, drop the ones a JavaScript predicate rejects, and
pull again until satisfied - rather than guessing a k wide enough to survive the filter.
The stream keeps walk state rather than a thread, and every pull is an ordinary call on the
executor of the receiver that opened it.
DenseSearchStreamMade by searchStream, never directly.