A cursor walks the contents, each pull writing up to wanted keys, and the keys each links to for NextLinks, into an arena; the vectors themselves come from Get. NextKeys pulls the keys alone, and a batch of none means the walk is exhausted. Cursor() yields every entry as stored, and Cursor(starts...) the starts’ own entries first, then the entries those link to breadth-first, each once.
Cursors answer on RAM and NVMe handles, while VRAM entries are read back by key or by search.
A search stream resumes one query’s walk, so a caller that post-filters aggressively pulls until satisfied instead of guessing the wanted count upfront.
Each Next writes up to wanted next-nearest matches into an arena as the one query of a search, and a query with none means the walk is drained.
Ordering beyond the expansion horizon is best-effort nearest rather than globally exact.
No residency streams matches yet, so SearchStream answers StatusUnsupported today.
stream, err := index.On(executor).SearchStream(usearch.RowsOf(query, dimensions), nil) if err != nil { log.Fatal(err)}defer stream.Close()for accepted := 0; accepted < 10; { matches, err := stream.Next(64, arena) if err != nil { log.Fatal(err)} found, _, _ := matches.Query(0) if len(found) == 0 { break // the walk is drained} for _, key := range found { if admits(key) { accepted++}}}
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.
type DenseSearchStreamInitConfig struct {
ExpansionFactor uint
}
Fields
ExpansionFactor
uint
ExpansionFactor is the breadth of the candidates the walk explores; zero derives it from the geometry.
StructDenseBatchDenseBatch is one cursor pull written into its arena: the keys, and beside them the keys each links to when NextLinks asked for them; the vectors themselves come from Get.3
LinksLinks borrows the keys one entry links to from the arena, refused with StatusInvalidArgument when the pull was NextKeys or entry is not below Written.
StructDenseDrawsDenseDraws is what Sample wrote into its arena, one entry per draw: its key, which of that key's entries it is, the shown or earlier draw it hangs from, and where it is placed.5
StructDenseSearchStreamDenseSearchStream is a resumable nearest-neighbor walk over one query, pulled blocking on the executor of the receiver that opened it.2