Skip to content

Feature/feature/semantic search#97

Merged
asvarnon merged 9 commits into
mainfrom
feature/feature/semantic-search
Jul 5, 2026
Merged

Feature/feature/semantic search#97
asvarnon merged 9 commits into
mainfrom
feature/feature/semantic-search

Conversation

@asvarnon

@asvarnon asvarnon commented Jul 5, 2026

Copy link
Copy Markdown
Owner

No description provided.

asvarnon added 9 commits July 5, 2026 09:53
   Adds full semantic search behind the `semantic` Cargo feature.

   Core changes:
   - `src/semantic/mod.rs`: `Embedder` trait (sync, Send+Sync); gated
     `FasEmbedder`
   - `src/semantic/fastembed_impl.rs`: fastembed 5.x wrapper with Mutex
     guard
     (TextEmbedding::embed takes &mut self); batch size 32;
     all-MiniLM-L6-v2
   - `src/traits.rs`: default no-op `save_embedding` and
     `search_semantic` on
     storage/searcher traits; `get_unembedded` fallback; tracing in all
     defaults
   - `src/storage/turso_storage.rs`: additive ALTER TABLE migration adds
     nullable `embedding BLOB` column; `save_embedding` writes via
     `vector32()`;
     `get_unembedded` queries `WHERE embedding IS NULL`
   - `src/storage/turso_searcher.rs`: `search_semantic` queries
     `vector_distance_cos(embedding, vector32(?))` ORDER BY dist ASC;
     score = (1.0 - dist).max(0.0)
     `get_unembedded` queries `WHERE embedding IS NULL`
   - `src/storage/turso_searcher.rs`: `search_semantic` queries
     `vector_distance_cos(embedding, vector32(?))` ORDER BY dist ASC;
     score = (1.0 - dist).max(0.0)
   - `src/engine.rs`: adds `embedder: Option<Arc<dyn Embedder>>` field
     (gated);
     `assemble` now runs BM25 + semantic then fuses via full-union RRF
     (k=60,
     worst_rank=51); recency decay and lexicon boost applied after RRF;
     `save_snapshot` embeds new entries non-fatally via spawn_blocking;
     `backfill_embeddings` for existing entries (batched, progress
     callback)
   - `src/builder.rs`: `with_embedding_model(cache_dir)` wires
     FasEmbedder
   - `src/lib.rs`: `pub mod semantic`, re-exports
     `Embedder`/`FasEmbedder`,
     `backfill_embeddings` on `ContextForge`
   - `Cargo.toml`: `tracing = "0.1"` (always), `fastembed` optional,
     `semantic`
     feature flag
@asvarnon asvarnon merged commit 5f1a7bf into main Jul 5, 2026
9 checks passed
@asvarnon asvarnon deleted the feature/feature/semantic-search branch July 5, 2026 18:26
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