sparsectx

command
v0.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command sparsectx backfills chunk_sparse_context (migration 040, #270 phase B) — the derived sparse-matching text (title/participants header + chunk body) the SEARCH_CHUNK_SPARSE=fuse_ctx search knob reads.

Usage

sparsectx --recipe=v1-tp [--batch 500] [--sleep 200ms] [--dry-run] [--sweep] [--limit 5000]

--recipe selects the sparse-text construction AND the chunk_sparse_context context_version the batch writes to: v1-tp (title+participants only) or v1-full (the same header the embedding pipeline uses). Required.

--dry-run (default true) computes candidates and reports what WOULD be written but performs no database mutation — mirrors cmd/recordingbackfill's dry-run-by-default convention for scripts that touch production data. Pass --dry-run=false to actually write.

--sweep additionally re-examines chunks whose chunk_sparse_context row EXISTS but has gone stale (its fingerprint no longer matches the parent document's current one — a title/metadata edit landed after the row was written); a plain run only picks up chunks with NO row yet. Either way, only what actually changed gets written — UpsertSparseContextBatch's fingerprint/text comparison skips a row that is already correct.

--limit caps the total number of chunks processed in this invocation (converted internally to a --batch-sized number of batches) — for staged production rollout: dry-run, then a couple of small batches, then the full off-peak pass (see docs/chunk-sparse-context.md).

Idempotent and resumable without any coordination between runs: each batch decides what still needs work directly from chunk_sparse_context's contents (see internal/store.ChunkStore.FetchSparseContextCandidates' doc comment), so interrupting a run (or the process being killed) and re-running with the same flags simply continues — no chunk is ever skipped, including one whose insert commits, out of id order, after an earlier run already looked past its id. Because there is no positional checkpoint to catch up on, --sweep should also be run PERIODICALLY (e.g. a cron alongside the initial backfill), not just once: the collector never writes chunk_sparse_context rows itself, so a plain (non-sweep) run only picks up brand-new chunks, and only --sweep catches documents that were edited (title rename, metadata merge, PII redaction) after their row was already written.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL