Skip to main content

Crate surrealdb_idx

Crate surrealdb_idx 

Source
Expand description

The SurrealDB index engines.

Each engine here owns one index structure: the full-text index and its analyzer, the HNSW and DiskANN vector graphs, the count index, the unique/non-unique entry index, and the document-id mapping they share. An engine is reached downward — through a transaction and an env::IndexEnv handle — and answers from the keyspace alone.

The pure computations those engines and the executor share — index key encoding and decoding, full-text term resolution and scoring, vector scoring — are kernels: functions over values and bytes that touch no storage, named in a registry. An executor that does its own reads hands what it read to them.

Choosing an index for a query, and iterating one on behalf of a statement, is not here: that is the planner’s job, and it lives above this crate with the executor that drives it.

This crate is an internal implementation detail of SurrealDB. Its API is unstable and changes without notice.

Re-exports§

pub use surrealdb_catalog as catalog;

Modules§

adjacency
Packed graph adjacency: the merged reader over blocks and per-edge keys.
config
The index and graph-adjacency engines’ configurable resource limits.
count
docids
Table-level document-ID (surrogate) space shared by all indexes on a table.
entry
The value stored under a b-tree index entry.
env
The environment the index engines run against.
expr
The type definitions for the computation format of the surreaql executor.
file
The allowlist every file an index engine opens has to resolve inside.
ft
index
This module applies index mutations for a single document across different index types (UNIQUE, regular, search, fulltext, Hnsw). Index keys are constructed via key::index and field values are encoded using key::value::Array.
inline_cache
Inline sidecar caches: one key holding a record’s complete adjacency in one direction (!ce), or its complete incoming reference set (!cr).
kernels
Kernels: the pure computations an index read or write is made of.
places
The node’s worker places, as the index engines take them.
spatial
Hierarchical Hilbert-curve spatial cell decomposition and region covering over the WGS84 (lon, lat) plane.
trees
val

Structs§

IndexKeyBase
PreviousBpSpelling
A previous release’s primary-appending keys for one build generation, with the generation’s prefix encoded once for however many records.
PreviousBuildPrimaryKey
A primary-appending marker’s key as a previous release spelled it: the generation’s prefix, then the record id under the index format.

Enums§

CompactionApply
What applying one compaction plan did.
Error
A failure in the index layer.

Functions§

check_index_kernel
Fails when this build left out the kernel an index of kind index needs.
index_exists_record
The record a unique-index conflict names, if error is one.
wipe_index_data
Clears everything an index has stored, and advances its compaction generation so that starting from empty does not unfence a compactor.
wipe_index_page
Deletes, in tx, at most limit of the keys the index ikb names holds, other than the compaction generations wipe_index_data reads and writes back, and answers how many it deleted.