feat: Graph Search Fusion with RRF re-ranking#30
feat: Graph Search Fusion with RRF re-ranking#30RaviTharuma wants to merge 2 commits intoAVIDS2:mainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Thanks for opening this — the graph + RRF direction is interesting, and I do think graph-aware retrieval is something Memorix should likely explore. That said, I don’t want to merge this PR as-is right now for two concrete reasons:
So my current maintainer take is: good direction, but not ready to merge in the current form. If you want to keep pushing it, the first step would be rebasing it to a graph-only diff on top of current |
09e13e9 to
ac76c57
Compare
|
Rebased to graph-only diff on current Branch now contains 1 commit:
Files changed (graph-only):
No commits from other PRs remain. Clean diff against Understood re: 1.0.6 layered retrieval architecture — happy to adapt the fusion approach once the retrieval architecture is locked. This rebase gives you a clean branch to evaluate whenever you're ready. |
|
Interesting direction. I like the idea of graph-assisted retrieval, but I can't take this one as-is yet. Immediate blocker: the PR is still red on Separately from the red CI, this is also touching a part of the search stack that we are about to restructure in 1.0.6 around provenance and layered retrieval. Once the type errors are fixed I'd like to take another look at how graph fusion should fit relative to L1 routing vs L2/L3 enrichment, rather than locking in a flat fusion path too early. |
|
Understood on both points. On the typecheck failure: I'll fix On the 1.0.6 restructure: that context is useful. Once the type errors are resolved, happy to discuss how graph fusion should slot in relative to the L1/L2/L3 layering rather than the current flat-fusion approach. I don't want to lock in a shape that conflicts with where provenance-aware retrieval is heading. Let me know if there's a design doc or draft for the 1.0.6 search changes I should read before the next revision. |
Add knowledge graph traversal as a 3rd retrieval source alongside BM25 and vector search. When graph data exists, entity names from search results seed a BFS traversal (1-2 hops), and all sources are merged via Reciprocal Rank Fusion (k=60). Changes: - src/search/rrf.ts: New RRF implementation with multi-source fusion - src/memory/graph.ts: graphSearch() BFS + getEntitiesForNames() - src/store/orama-store.ts: Graph fusion gate in searchObservations() - src/server.ts: Wire setGraphManager() into store initialization Tests: 18/18 integration tests, 23/23 RRF unit tests pass. Gate conditions: graph fusion activates only when graphManager is set and has entities. Falls back gracefully to BM25+vector otherwise. Closes: memorix-awr
The map+filter chain produced objects with score: number (non-optional) but the type predicate 'e is IndexEntry' required IndexEntry assignability, which failed because IndexEntry.score is number | undefined. Replaced with a simple for-loop that pushes directly into IndexEntry[], eliminating the null intermediate and the predicate mismatch entirely.
d963901 to
853dde5
Compare
|
Rebased on main. Resolved two merge conflicts:
Also fixed a TypeScript type predicate error in Typecheck clean, 136 search tests pass. Ready for re-review. |
AVIDS2
left a comment
There was a problem hiding this comment.
The branch is cleaner than before and I appreciate the rebase work, but I still don’t want to merge this in the current shape. After the layered retrieval / provenance work that has now landed, graph retrieval needs to slot into that model deliberately; this PR still hard-wires graph expansion as a flat RRF fusion path inside the Orama search pipeline. That is a bigger architectural mismatch now than it was when this first opened. If you want to keep pushing it, the next revision should be reworked against the current layered retrieval direction instead of trying to merge graph as a third flat source directly inside searchObservations().
Summary
Adds knowledge graph traversal as a 3rd retrieval source alongside BM25 and vector search. When graph data exists, entity names from search results seed a BFS traversal (1-2 hops), and all sources are merged via Reciprocal Rank Fusion (k=60).
Changes
src/search/rrf.tssrc/memory/graph.tsgraphSearch()BFS traversal +getEntitiesForNames()helpersrc/store/orama-store.tssearchObservations()— activates only when graph has entitiessrc/server.tssetGraphManager()into store initialization (2 call sites)How it works
entityNamefield)graphManageris set and contains entities, BFS traverses 1-2 hops from matched entities1/(k + rank)scoring)Gate conditions (zero breaking changes)
Graph fusion only activates when:
graphManageris set on the store (viasetGraphManager())Otherwise falls back to existing BM25+vector behavior — fully backward compatible.
Tests
tests/search/, 5 pre-existingvi.resetModulesfailures unrelated)Design decisions