Skip to content

fix(search): preserve tokenizer migration compatibility - #181

Draft
samzong wants to merge 4 commits into
mainfrom
fix/search-index-compatibility
Draft

fix(search): preserve tokenizer migration compatibility#181
samzong wants to merge 4 commits into
mainfrom
fix/search-index-compatibility

Conversation

@samzong

@samzong samzong commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an append-only trigram FTS migration while retaining unicode61 for short and ASCII queries
  • preserve full trigram coverage for legacy or downgraded writes while indexing only new CJK messages in the trigram table
  • retry deferred migrations safely and keep writes compatible before the new column is available
  • cover short, mixed, ahead-version, rebuild, delete-trigger, downgrade-write, and lock-deferral behavior

Why

Short lexical terms were discarded by the trigram path, and a deferred migration could send trigram grammar to the active unicode61 index. Maintaining two full indexes also caused a real write and search regression. This keeps query grammar aligned with the available index, preserves upgrade and downgrade compatibility, and avoids the steady-state performance cost for new non-CJK messages.

Verification

  • cargo test -p recall search_keeps_short_mixed_and_deferred_legacy_terms_without_embeddings
  • cargo test -p recall migrate_v12_retries_after_worker_lock_deferral
  • cargo test -p recall init_recreates_missing_trigram_fts_and_reindexes_existing_messages
  • same-machine Criterion comparison against the parent commit: write and search medians returned to baseline range
  • make check

Signed-off-by: samzong <samzong.lu@gmail.com>
@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 22 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing fix/search-index-compatibility (8a98467) with main (3dd6496)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@samzong
samzong marked this pull request as draft August 27, 2026 03:27
Signed-off-by: samzong <samzong.lu@gmail.com>
…atibility

Signed-off-by: samzong <samzong.lu@gmail.com>
Signed-off-by: samzong <samzong.lu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant