Results and reports
What queries return, and what the maintenance calls report back.
On this page
Query hits
query and query_sparse return hits closest first. In Rust that is a Vec<Hit>; in Python, Hits, a sequence of Hit.
| Field | Rust | Python | What it holds |
|---|---|---|---|
id | String | str | The document’s id. |
distance | f32 | float | Lower is closer, for every metric. It can be negative under dot product and in sparse hits. |
attrs | Option<serde_json::Value> | dict[str, Any] or None | The document’s attributes, exactly as stored. |
Compare distances within one query only: the scale differs between metrics. Querying defines each one.
Python’s Hits adds a few ways to read them at once:
hits.ids: a list of ids.hits.distances: a NumPyfloat32array.hits.to_arrow()andhits.to_polars(): a table withid,distance, then one typed column per declared attribute field. They need pyarrow or polars installed.
print(hits.ids, hits.distances)
print(hits.to_polars()) # id, distance, then one typed column per declared attributeUse to_polars() rather than pl.DataFrame(hits). Polars reads a Python sequence as rows, which loses the typed columns.
Filter pages
filter returns one page of matching documents in id order: FilterPage in both languages. It reads no vectors, so each row is a Row with only id and attrs.
| Field | Rust | Python | What it holds |
|---|---|---|---|
rows | Vec<Row> | list[Row] | The matching rows, in ascending id order. |
next | Option<String> | str or None | Pass it as after for the next page. None when the scan ran out. |
next is set whenever a page is full, so a page that ends exactly at the last match still has one, and the page after it is empty with next unset. A Python FilterPage is also a sequence of its rows and has to_arrow() and to_polars() (id, then one column per attribute field). Filtering shows the paging loop.
Compaction
compact reports what it did. Rust returns the Compaction enum; Python a Compaction with a kind string and the same fields.
| Rust | Python kind | Meaning |
|---|---|---|
Nothing | "nothing" | The tail was empty and the segment count was within the limit. |
Published { .. } | "published" | New segments were written and the manifest lists them. |
Superseded | "superseded" | Another process compacted first, so this run published nothing. That’s fine, not an error. |
Published carries:
| Field | What it holds |
|---|---|
segments | Ids of the new segments, oldest first. One, unless the result was over max_segment_bytes and split. |
folded_through | The last WAL sequence number now folded into segments. |
merged_segments | How many existing segments were merged. 0 for a plain fold. |
docs | Live documents in the new segments. |
tombstones | Deletions kept in the new segments so they still hide older copies. 0 when a merge starts at the beginning of the log. |
Index reports
index returns an IndexReport and index_sparse an IndexSparseReport. Every live segment the call looked at lands in exactly one count.
| Field | What it counts |
|---|---|
indexed | Segments this run published an index for. |
skipped_small (dense only) | Segments under min_rows documents. |
skipped_no_sparse (sparse only) | Segments with no sparse vector. |
already_indexed | Segments that had an index already (without rebuild), or that another indexer finished first. |
superseded | Segments a compaction retired while the run worked. An index object it wrote is left for gc. |
Garbage collection report
gc returns a GcReport. With dry_run the counts are what a real run would have done. An object that was already gone still counts, so two collectors running at once can count the same segment.
| Field | What it counts |
|---|---|
segments_deleted, bytes_freed | Dead segments removed, and the total size of every object removed. |
segments_too_young | Dead segments kept because they, or the segment that replaced them, are younger than min_age. |
wal_objects_fenced, wal_bytes_freed | WAL objects replaced by a fence (only with fence_wal), and what they held less the fences. |
wal_too_young | WAL objects kept because they, or the segment holding them, are younger than min_age. |
indexes_deleted, indexes_too_young | Dense index objects of live segments the manifest no longer names: removed, or kept for now. |
sparse_indexes_deleted, sparse_indexes_too_young | The same for sparse indexes. |
Maintenance report
maintain returns a MaintenanceReport:
| Field | What it holds |
|---|---|
tail_objects | WAL objects past the fold point when the call looked. |
tail_bytes | Their stored size. |
compaction | What the compaction did, or None if none was due. |
gc | What the collection did, or None if none was asked for. |
In Python the report also has index and index_sparse, which the background maintainer fills when it builds indexes too.
The background maintainer
Python’s start_maintenance returns a Maintainer:
| Member | What it is |
|---|---|
stop() | Stops the loop. close() and leaving a with block also stop it. |
running | Whether the loop is still going. |
runs | How many runs have finished. |
errors | How many of them failed. |
last_error | The last failure’s message, or None. |
last_report | The last run’s MaintenanceReport, or None. |
Recovery report
Namespace::recover (Rust only) returns the handle and a RecoverReport:
| Field | What it holds |
|---|---|
live_segments | The segment ids the new manifest lists, oldest first. |
folded_through | Where the segment chain ends in the WAL. |
tail_objects | WAL objects past that point, which queries fold in as the tail. |
unused_segments | Segment directories left out of the chain: dead ones gc hasn’t collected, or ones that didn’t decode. They’re left alone. |
