Files
silo-server/migrations/sql
e96a8a0cf8 feat(search): binary-quantized embedder vectors — optional, default-on for fresh installs (#351)
* feat(search): binary quantization setting for the Meilisearch embedder

New server setting catalog.search.meilisearch.binary_quantized
(default false) threads into the embedder index settings
("binaryQuantized": true) and into the schema-version hash, so flipping
it closes the sync gate and mandates a rebuild in both directions —
Meilisearch cannot de/re-quantize an index in place.

With 3072-dimensional embeddings this cuts vector storage ~32x
(≈12KB → 384B per document), keeping the whole vector store in page
cache: rebuilds and hybrid queries get sharply cheaper. Hybrid search
(keyword + semantic) cushions the small relevance cost of sign-only
vectors.

The hash token is appended only when the flag is set, so indexes built
before this change keep their schema version while it stays off.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(search): binary quantization default-on for fresh installs + admin toggle

- Migration seeds catalog.search.meilisearch.binary_quantized=true only
  when no active catalog search index exists. Existing deployments stay
  unset (= off): flipping quantization changes the index schema-version
  identity, which closes the incremental-sync gate until a full rebuild
  runs — that must never happen implicitly on upgrade. Fresh installs
  have no index yet, so their first rebuild simply starts quantized.
- Search settings page gains the toggle with an explicit
  "requires a full index rebuild" warning, a status row, and settings-
  search keywords.

Prod benchmark (607.9k docs, 3072-dim vectors, N=10 medians, replicated):
hybrid 0.5 unchanged (7.5ms float vs 8.0ms quantized, within ±2ms
keyword-control jitter); pure semantic 9ms → 4ms; on-disk index 18G →
8.3G; rebuild duration unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(search): address review feedback on binary-quantized embedder

- Add catalog.search.meilisearch.binary_quantized to the restart-required
  registry. The provider freezes BinaryQuantized into MeilisearchProviderConfig
  at construction, so without this a toggle-then-rebuild in the same process
  builds a quantized schema while the live provider still compares against the
  old value and falls back until restart (Codex P2).
- Validate binary_quantized in HandleUpdateSetting, mirroring semantic_enabled.
  A raw API write of a non-bool previously persisted unnormalized, then failed
  CatalogSearchSettingsFromMap on load and silently reverted the entire search
  config to Postgres defaults.
- Gate the binary_quantized token in the schema-version identity on
  semanticEnabled: with semantic off the index has no embedders, so the flag
  has no on-index effect and must not force a pointless rebuild. Stays
  byte-identical to a pre-flag index. Covered by a new test.
- Clarify the seed migration comment (guard is "no active index", which also
  covers Meilisearch-configured-but-never-indexed deployments) and the UI hint
  (~30x smaller raw vectors, index roughly halves; only applies with semantic).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: rxwatcher <rxwatcher@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 09:55:51 -04:00
..