Skip to content

feat(ann): filter-aware candidate retrieval (#3) - #80

Merged
eSlider merged 1 commit into
mainfrom
sync/ann-filter
Nov 11, 2026
Merged

eSlider merged 1 commit into
mainfrom
sync/ann-filter

Conversation

@eSlider

@eSlider eSlider commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Mirror of Gitea PR #8 (feat(ann): filter-aware candidate retrieval (#3)), rebased on the mirrored #4 tombstones work.

  • rank.Filter — single eligibility definition for root/repo/as_of; FTS and exact scan use the same predicates.
  • ANN Row carries root/source/valid_from/valid_to; SearchFiltered filters inside the cell scan and escalates probes until enough eligible candidates (full index for rare filters).
  • FTS pushes root/repo into Cypher; as_of escalates limit*3 up to a 2048-candidate cap with a loud warning.
  • Empty filtered ANN result falls through to the exact scan — no false (not confirmed) from a stale index.
  • Snapshot v2 (2DPHANN2): v1 is refused with ErrStaleFormat and rebuilt by ensure; old WAL lines still replay.
  • Filtered eval gate (root=facts, repo, as_of) added next to the unfiltered gate.

Measured on a copy of the live corpus (43,133 leafs / 39 facts), n=5: 2/13 → 6/13 queries return a fact; the 9 issue queries go 0/9 → finds onlyoffice, edelweiss.

Verified: go vet ./..., go test ./internal/brain/ann ./internal/brain/rank, gitleaks — clean. Rollout note: v1 index is rebuilt on the next ann ensure; until then serve uses the linear scan.

@eSlider
eSlider merged commit 7601a44 into main Nov 11, 2026
6 checks passed
@eSlider
eSlider deleted the sync/ann-filter branch November 11, 2026 13:45
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