Repository navigation
feat: fulltext ranking seam for replay (menhir#469) - #42
Merged
Merged
Conversation
node_fulltext_search and edge_fulltext_search consult a FulltextRanking hook bound on a ContextVar. With no hook nothing changes. A hook can record the ranked uuids the search returned, or serve uuids in place of the search: the items are read by uuid and returned in the served order, and served uuids missing from the graph are reported to the hook. BM25 scores use statistics over the whole fulltext index, so other groups' documents and unmerged deleted documents change near-tie rankings. Menhir's replay into another database needs the source's ranking (getzep#469). The cosine lanes compare stored vectors only and are not hooked. Label: Menhir policy divergence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Menhir's search interface runs the stock fulltext query by calling node_fulltext_search again. The nested call consulted the hook too, so a capture recorded every ranking twice while a replay served it once. The live search now runs with the hook unbound; only the outermost call records or serves. Label: Menhir policy divergence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A
FulltextRankinghook (ContextVar,graphiti_core/fulltext_ranking.py) for the BM25 lanes ofsearch():node_fulltext_search/edge_fulltext_searchconsult it. No hook bound: no change.ranking()returns None: the search runs andobserved()gets the ranked uuids.ranking()returns uuids: the search does not run; items are read withget_by_uuidsin the served order, and missing uuids go tounavailable().search_interfacethat delegates back to the same function (Menhir's does) records once.0.32.1.post5.Why
BM25 scores use statistics over the whole fulltext index, not the searched group. Other groups' documents and deleted documents not yet merged away change near-tie rankings, so a Menhir replay into another database got different invalidation candidates and correlation pools (Archolith/menhir#469). The cosine lanes compare stored vectors only and are not hooked.
Evidence
tests/test_fulltext_ranking.py(added to the compatibility workflow).unchanged, 0 misses, 0 network calls, every namespace digest equal. The same setup without the seam replayed 1 namespace of 14.Label: Menhir policy divergence
🤖 Generated with Claude Code