{{ message }}
Repository navigation
fix: apply Neo4j invalidation filters before fulltext result limits - #1970
Draft
Frankie-Xu wants to merge 1 commit into
Draft
Frankie-Xu wants to merge 1 commit into
Frankie-Xu wants to merge 1 commit into
Conversation
Contributor
This branch has not been deployed
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.

Summary
Neo4j can discard the current fact before an invalidation filter sees it.
queryRelationshipscurrently returns only the first 20 index hits for the hybrid candidate search, then Cypher appliesinvalid_atfiltering. With 20 or more better-ranked superseded facts, a current fact below the vector threshold can still be missed.Omit the Neo4j procedure-level cap for edge searches with an
invalid_atfilter, then keep the existing ordered result limit after filtering. Apply this to the production generic search path and the Neo4j operations path. Unfiltered searches and other providers keep their existing query behavior.This is a focused follow-up to #1957; it does not include or replace that PR's candidate-filter change. The candidate filter in #1957 and this retrieval fix address different stages of the same failure. This PR alone does not fully resolve #1956; merge it together with #1957. The combined fixture tests exercise both changes.
Type of change
rfc-approved)Related issue
Fixes #1956
Related candidate-filter PR: #1957, reviewed at
de2c8a2c81cf697342c74293042510deee0d6f44.Design approval
rfc-approvedlabel after discussion with the Graphiti team.Testing
make checkpasses.Local, no model/API calls:
tests/utils/search/test_temporal_fulltext_candidates.py: 15 passed in an isolated checkout environment, Python 3.14.6. Cases cover 19/20/50 obsolete hits, exact cutoff, later-ending facts, 35 eligible facts still returning 20 in score order, unfiltered index-limit preservation, and unchanged other-provider helper output.valid_at, cutoff boundaries, backfill and duplicate-start controls.The synthetic executor evaluates emitted WHERE predicates in SQLite while preserving the procedure-cap/filter/final-limit order. The combined fixtures execute Graphiti's query construction, record parsing, hybrid RRF and resolver with a stub judge. These are not native Neo4j, Lucene ranking, embedding-quality or model-accuracy measurements. The optional procedure options map is documented by Neo4j.
Native Neo4j integration, performance, Python 3.10, and full
make checkhave not been verified. No Docker daemon is available locally.Breaking changes
Existing helper callers retain the default behavior. Searches with
invalid_atfilters can visit more fulltext hits; their final ordered result limit remains unchanged. This does not fix ranking among more than 20 eligible facts, duplicate/other-field search limits, or the separate Kuzu/Neptune pre-filter candidate caps.Checklist
AI assistance: implemented and reviewed locally with OpenAI Codex.