Skip to content

feat: unify BM25 scoring with persistent namespace MAP - #359

Merged
EricNGOntos merged 6 commits into
mainfrom
feat/wuchengke/2026-08-31
Aug 31, 2026
Merged

EricNGOntos merged 6 commits into
mainfrom
feat/wuchengke/2026-08-31

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Persist namespace MAP snapshots and map-unit indexes (including average IDF) so classic and map-nav share one DB-backed BM25 path at query time
  • Load token frequencies by query tokens instead of unpacking full revision frequency blobs; keep agentic map-nav episode flow unchanged aside from score loading
  • Add conversation_id plumbing for retrieval, clean obsolete BM25/FTS prefilter paths, and rebase onto latest main (snapshot payload bounds + revision grouping)

Test plan

  • make check (lint + pyright)
  • Contract: classic map-unit, map-unit index, lazy snapshot quality
  • Manual agentic (mapnav) retrieval on Changheba sample questions
  • CI checks on this PR

Made with Cursor

EricNGOntos and others added 5 commits August 31, 2026 18:22
- Updated the backfill_map_unit_indexes script to include patching of the namespace map snapshot after persisting the revision serving state.
- Removed outdated contract tests related to BM25 FTS prefilter and unit tests for BM25 channel token preparation.
- Refactored retrieval logic to improve handling of document map units, including new fields for asset presence.
- Added new test cases for document publishing and scoring with additional image chunks.
- Refactored the lazy snapshot retrieval logic to improve score preservation without unnecessary payload reads.
- Updated the handling of incomplete index scenarios to ensure empty scores are returned when no data is available.
- Removed obsolete methods related to document unit loading to streamline the codebase.
- Introduced new fields `average_idf_path` and `average_idf_content` in the DocumentMapUnitIndex for improved scoring accuracy.
- Updated the retrieval logic to calculate average IDF values during document map unit processing.
- Refactored map unit discovery to utilize average IDF in scoring calculations, enhancing retrieval performance.
- Removed obsolete code related to previous scoring methods to streamline the implementation.
Co-authored-by: Cursor <cursoragent@cursor.com>
import sqlalchemy as sa


revision: str = "6c7d8e9f0a1b"


revision: str = "6c7d8e9f0a1b"
down_revision: str | None = "5b6c7d8e9f0a"

revision: str = "6c7d8e9f0a1b"
down_revision: str | None = "5b6c7d8e9f0a"
branch_labels: Sequence[str] | None = None
revision: str = "6c7d8e9f0a1b"
down_revision: str | None = "5b6c7d8e9f0a"
branch_labels: Sequence[str] | None = None
depends_on: Sequence[str] | None = None
Co-authored-by: Cursor <cursoragent@cursor.com>
@EricNGOntos
EricNGOntos merged commit 10d61eb into main Aug 31, 2026
6 checks passed
@EricNGOntos
EricNGOntos deleted the feat/wuchengke/2026-08-31 branch August 31, 2026 11:43
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.

2 participants