Skip to content

fix(server): two-step bm25 to avoid content-table JOIN restriction - #3

Merged
mtib merged 1 commit into
mainfrom
fix/hybrid-search-bm25
May 20, 2026
Merged

mtib merged 1 commit into
mainfrom
fix/hybrid-search-bm25

Conversation

@mtib

@mtib mtib commented May 20, 2026

Copy link
Copy Markdown
Owner

Problem

bm25() fails with unable to use function bm25 in the requested context whenever the FTS5 virtual table is joined against a real table — even inside a subquery — when the FTS table uses content=.

Fix

Fetch (rowid, score) from entries_fts alone first, then resolve doc_id with a separate IN query on entries. Two round-trips, but avoids the SQLite restriction entirely.

…tion

SQLite FTS5 bm25() fails in any query that JOINs the virtual table against
a real table, even inside a subquery, when the FTS table uses content=.
Fetch (rowid, score) from the FTS table alone, then resolve doc_id with a
separate IN query on entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mtib
mtib merged commit 0d41ac9 into main May 20, 2026
1 check passed
mtib added a commit that referenced this pull request May 21, 2026
Replace Parakeet TDT 0.6B v3 (3 GB peak, not realtime on M1 Air) with three
CTC-headed offline models behind the existing picker:

- Parakeet TDT-CTC 110M (EN, ~99 MB) — default, best English quality
- FastConformer CTC multilingual (EN/DE/ES/FR, ~98 MB) — adds German
- Moonshine Tiny (EN, ~45 MB) — kept as lightest fallback

Both new models settle at ~630 MB RSS with mic + system active; ~4 s load
time under CoreML. Settings migrates the stored "parakeet" value.

Pipeline: when system audio is voiced, the mic stream is now fully gated —
no resample, no VAD, no decode. Mic VAD is flushed on gate entry so any
open segment closes cleanly. The single shared recognizer (NSLock) is
unchanged. Also tightened VAD buffer compaction (after every drain).

Quit UX: applicationShouldTerminate now returns .terminateLater and drains
on a detached task, replying once flush completes. MenuBarController gets
beginQuitTransition() to dim the status item and freeze the label.
Measured quit on a running pipeline: 0.74 s (was up to 5 s of frozen UI).

Cleanup: delete the orphaned RNNoise wrapper, DenoisingAudioSource, and
vendored CRNNoise target — Pipeline never wired them in.

CLAUDE.md: refreshed architecture diagram and model table, documented
NSString lifetime across C calls (bite #3) and why the 0.6B was dropped
(bite #2).
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