sjs004 opened a new pull request, #16993: URL: https://github.com/apache/lucene/pull/16993
### Description `BlendedInfixSuggester` already deduplicates results in a `TreeSet`. The bug is that `boundedTreeAdd()` evicts the weakest result before trying to insert a stronger candidate. When that candidate duplicates an existing result, `TreeSet.add()` rejects it, but the evicted suggestion is already lost. ## Example Build with these inputs and request two suggestions for `lake`: | Input | Original weight | Score after position blending | | --- | ---: | ---: | | `the lake` | 1000 | 900 | | `lake` | 950 | 950 | | `lake` (duplicate) | 950 | 950 | | `my lake` | 920 | 828 | The default linear blender discounts a match at word position 1 by 10%. A suggestion beginning with the query keeps its full weight. The expected top two are therefore `lake/950` and `the lake/900` | Version | Returned suggestions, strongest first | | --- | --- | | Before fix (buggy) | `[lake/950, my lake/828]` | | After fix (expected) | `[lake/950, the lake/900]` | The bug drops `the lake/900` and returns the weaker `my lake/828` in its place Finding: [LFV-700](https://shbhar.github.io/lucene-ai-bug-hunt/bugs/LFV-700.html). Tracking issue: [apache/lucene#16937](https://github.com/apache/lucene/issues/16937). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
