Dawid Weiss created LUCENE-10540:
------------------------------------

             Summary: Remove alphabetically ordered completions from 
FSTCompletion
                 Key: LUCENE-10540
                 URL: https://issues.apache.org/jira/browse/LUCENE-10540
             Project: Lucene - Core
          Issue Type: Improvement
            Reporter: Dawid Weiss


The code cheats internally by sorting completions that are always 
weight-ordered. If this is needed, it should be done up the call stack, not in 
FSTCompletion - this provides an illusion of something that doesn't exist and 
is potentially quite expensive to compute.

{code}
    if (!higherWeightsFirst && rootArcs.length > 1) {
      // We could emit a warning here (?). An optimal strategy for
      // alphabetically sorted
      // suggestions would be to add them with a constant weight -- this saves
      // unnecessary
      // traversals and sorting.
      return lookup(key).sorted().limit(num).collect(Collectors.toList());
    } else {
      return lookup(key).limit(num).collect(Collectors.toList());
    }
{code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to