Summary
The UI search endpoint /api/memory/search currently uses SearchWithMetadataEmbedding, which fails to return results for short keyword queries (e.g., "race condition", "phobos"). The root cause and fix are documented in ADR docs/adr/2026-02-14-hybrid-search-rrf.md: cosine-similarity compression makes the default 0.7 threshold eliminate genuinely relevant content, while HybridSearch (vector + PostgreSQL FTS + Reciprocal Rank Fusion) resolves it — it's already the default in the MCP SearchMemories tool but was never wired into the web UI.
Changes
Backend (src/Memorizer/Controllers/MemoryController.cs)
SearchMemories (GET /api/memory/search) gains a [FromQuery] string? method = "hybrid" parameter.
hybrid (default) → _storage.HybridSearch(...); vector → existing SearchWithMetadataEmbedding. No storage-layer changes needed — both methods already exist on IStorage with identical signatures.
Frontend (src/Memorizer/Views/Home/Index.cshtml)
- Add a Hybrid / Vector mode toggle to the search bar (Hybrid is the default).
- Hybrid mode: placeholder "Search memories...", button "Search", hide the "Min similarity (0-1)" field (a no-op for HybridSearch per the ADR).
- Vector mode: show the min-similarity field and the "Vector Search" button.
- Rename
runVectorSearch() → runSearch() passing method=. Relabel the results header.
- The sidebar search (
/memories?q=...) routes through the same code path and benefits automatically.
Notes
- No dependencies.
minSimilarity is accepted but not applied by HybridSearch (by design); the parameter is retained for API compatibility.
Summary
The UI search endpoint
/api/memory/searchcurrently usesSearchWithMetadataEmbedding, which fails to return results for short keyword queries (e.g., "race condition", "phobos"). The root cause and fix are documented in ADRdocs/adr/2026-02-14-hybrid-search-rrf.md: cosine-similarity compression makes the default 0.7 threshold eliminate genuinely relevant content, whileHybridSearch(vector + PostgreSQL FTS + Reciprocal Rank Fusion) resolves it — it's already the default in the MCPSearchMemoriestool but was never wired into the web UI.Changes
Backend (
src/Memorizer/Controllers/MemoryController.cs)SearchMemories(GET /api/memory/search) gains a[FromQuery] string? method = "hybrid"parameter.hybrid(default) →_storage.HybridSearch(...);vector→ existingSearchWithMetadataEmbedding. No storage-layer changes needed — both methods already exist onIStoragewith identical signatures.Frontend (
src/Memorizer/Views/Home/Index.cshtml)runVectorSearch()→runSearch()passingmethod=. Relabel the results header./memories?q=...) routes through the same code path and benefits automatically.Notes
minSimilarityis accepted but not applied byHybridSearch(by design); the parameter is retained for API compatibility.