[jira] [Updated] (LUCENE-7968) AnalyzingSuggester's comparator compares incorrectly

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Updated] (LUCENE-7968) AnalyzingSuggester's comparator compares incorrectly

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/LUCENE-7968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir updated LUCENE-7968:
    Attachment: LUCENE-7968.patch

Patch, including a test that fails even without the assert. It just adds 50 surface forms with the same weight that all analyze to the same string, and asserts that lookup() returns them back in sorted order by surface form.

When payloads=false, the BytesRef's length should be the {{remaining}} bytes, not negative.

> AnalyzingSuggester's comparator compares incorrectly
> ----------------------------------------------------
>                 Key: LUCENE-7968
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7968
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-7968.patch
> Found by LUCENE-7966, but we should fix here separate.
> Currently the tie-break case of this comparator is buggy when {{hasPayloads=false}}, as it assigns *negative* lengths to the BytesRefs being compared. The current BytesRef.compareTo simply silently returns false in this case, hiding the bug.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]