apache / apache/lucene

Question for PriorityQueue Reconstruction in SloppyPhraseMatcher's advanceRpts method.

Open
#13,520 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

https://github.com/apache/lucene/blob/33a4c1d8ef999902dacedde9c7f04a3c7e2e78c9/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseMatcher.java#L311

Hi, for this line of code, I got confused on this PriorityQueue Reconstruction step, shouldn't it check that the popped pp2 is in the same rptGroup as the original pp? Why it only checks rptGroup>=0? The popped pp2 can be from another rptGroup so that the real resolved pp never got popped out.

Or there is some theory that guarantees if we pop n elements and push them back, then the heap can be correctly re-constructed? (I came up with some simple counter-examples so I guess there is no such a theory? Please correct me if there is one)

Thanks a lot!

Contributor guide

Open the contributing guide

Research direction

Start at lucene/core/src/java/org/apache/lucene/search/SloppyPhraseMatcher.java around line 311 and trace advanceRpts, the PriorityQueue reconstruction, and rptGroup handling. Compare the heap behavior with the issue's counterexamples and relevant Lucene search tests. Done means establishing whether the reconstruction is correct and, if not, documenting the failure and the required correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.