Skip to content

Fix PISA top_n_count to compute BM25 scores and maintain top-k#1

Open
MBkkt wants to merge 1 commit into
masterfrom
claude/fix-pisa-top-n-count-q8Cdo
Open

Fix PISA top_n_count to compute BM25 scores and maintain top-k#1
MBkkt wants to merge 1 commit into
masterfrom
claude/fix-pisa-top-n-count-q8Cdo

Conversation

@MBkkt

@MBkkt MBkkt commented Mar 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Intersection/single-term: scored_and_query returns all scored results; added std::nth_element to compute top-k, count from .size()
  • Union: Inlined ranked_or_query loop with topk_queue + count++ in a single pass using scored cursors for BM25

Previously the union path used unscored make_cursors (no BM25) and neither path maintained top-k results.

Test plan

  • Build PISA engine via Docker and verify compilation
  • Run TOP_10_COUNT / TOP_100_COUNT / TOP_1000_COUNT queries and verify counts match COUNT command output
  • Verify top-k scores are correct by comparing against TOP_N output

https://claude.ai/code/session_01Ttc55r4opG456zn7i8wLWf

Previously, TOP_N_COUNT commands for PISA did not compute BM25 scores
(union path used unscored cursors) and did not maintain top-k results.

- Intersection/single-term: use scored_and_query + std::nth_element for top-k
- Union: inline ranked_or_query loop with scored cursors, topk_queue, and
  document counting in a single pass

https://claude.ai/code/session_01Ttc55r4opG456zn7i8wLWf
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