Andras Salamon created SOLR-14360:
-------------------------------------

             Summary: Speed up Levenshtein distance calculation when we don't 
need the exact distance
                 Key: SOLR-14360
                 URL: https://issues.apache.org/jira/browse/SOLR-14360
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
            Reporter: Andras Salamon
         Attachments: SOLR-14360-01.patch

Sometimes when we calculate the Levenshtein distance we don't need the exact 
distance, we only want to know if the strings are similar enough.

[https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/spelling/SolrSpellChecker.java#L113-L114]
{noformat}
sug.score = sd.getDistance(original, sug.string);        
if (sug.score < min) continue; {noformat}
If we use this threshold in the distance calculation, we can speed it up, we 
can stop the calculation when we already know that the the the distance will be 
lower than the threshold.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to