Skip to main content

Module id_map

Module id_map 

Source
Expand description

Bidirectional binding between HNSW node ids and document ids.

Each HNSW index (keyed by its index key: "{collection}" for the base vector, "{collection}:{field}" for a named one) binds every document id to at most one live node, and every node to one document id. Both directions live behind one type, so no caller can update one side only.

Bindings are grouped per index key rather than flattened into "{index_key}:{node}" strings. A flat string key makes chat a prefix of chat2:* and of the named key chat:field:*, so a prefix match leaks nodes of one index into another. The flat form survives only as the persisted layout (VectorIdMap::to_entries / VectorIdMap::from_entries).

Structs§

AttachedVectors
The vectors attached to one document id of one collection.
IndexIdMap
The node ↔ document bindings of one HNSW index.
VectorIdMap
The node ↔ document bindings of every HNSW index, keyed by index key.

Functions§

persisted_index_key
The index key of one persisted binding: its composite key minus the ":{node}" suffix. None when the composite key does not end in its own node id.

Type Aliases§

PersistedIdEntry
One persisted binding: ("{index_key}:{node}", doc_id, node).