ITZMA is still taking shape, and its API can change between releases. Version 0.2.1: serde_with security fix
Docs / Reference

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.

FieldRustPythonWhat it holds
idStringstrThe document’s id.
distancef32floatLower is closer, for every metric. It can be negative under dot product and in sparse hits.
attrsOption<serde_json::Value>dict[str, Any] or NoneThe 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 NumPy float32 array.
  • hits.to_arrow() and hits.to_polars(): a table with id, distance, then one typed column per declared attribute field. They need pyarrow or polars installed.
python
print(hits.ids, hits.distances)
print(hits.to_polars())  # id, distance, then one typed column per declared attribute

Use 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.

FieldRustPythonWhat it holds
rowsVec<Row>list[Row]The matching rows, in ascending id order.
nextOption<String>str or NonePass 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.

RustPython kindMeaning
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:

FieldWhat it holds
segmentsIds of the new segments, oldest first. One, unless the result was over max_segment_bytes and split.
folded_throughThe last WAL sequence number now folded into segments.
merged_segmentsHow many existing segments were merged. 0 for a plain fold.
docsLive documents in the new segments.
tombstonesDeletions 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.

FieldWhat it counts
indexedSegments 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_indexedSegments that had an index already (without rebuild), or that another indexer finished first.
supersededSegments 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.

FieldWhat it counts
segments_deleted, bytes_freedDead segments removed, and the total size of every object removed.
segments_too_youngDead segments kept because they, or the segment that replaced them, are younger than min_age.
wal_objects_fenced, wal_bytes_freedWAL objects replaced by a fence (only with fence_wal), and what they held less the fences.
wal_too_youngWAL objects kept because they, or the segment holding them, are younger than min_age.
indexes_deleted, indexes_too_youngDense index objects of live segments the manifest no longer names: removed, or kept for now.
sparse_indexes_deleted, sparse_indexes_too_youngThe same for sparse indexes.

Maintenance report

maintain returns a MaintenanceReport:

FieldWhat it holds
tail_objectsWAL objects past the fold point when the call looked.
tail_bytesTheir stored size.
compactionWhat the compaction did, or None if none was due.
gcWhat 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:

MemberWhat it is
stop()Stops the loop. close() and leaving a with block also stop it.
runningWhether the loop is still going.
runsHow many runs have finished.
errorsHow many of them failed.
last_errorThe last failure’s message, or None.
last_reportThe last run’s MaintenanceReport, or None.

Recovery report

Namespace::recover (Rust only) returns the handle and a RecoverReport:

FieldWhat it holds
live_segmentsThe segment ids the new manifest lists, oldest first.
folded_throughWhere the segment chain ends in the WAL.
tail_objectsWAL objects past that point, which queries fold in as the tail.
unused_segmentsSegment directories left out of the chain: dead ones gc hasn’t collected, or ones that didn’t decode. They’re left alone.
Docs
esc

Loading the docs…