0
0

Merge pull request #476 from steveyen/optimize-fuzzy-searcher-prefixTerm-loop

end fuzzy searcher prefixTerm construction loop early
This commit is contained in:
Marty Schoch 2016-10-12 23:04:50 +02:00 committed by GitHub
commit ac02b206e5

View File

@ -30,10 +30,13 @@ type FuzzySearcher struct {
}
func NewFuzzySearcher(indexReader index.IndexReader, term string, prefix, fuzziness int, field string, boost float64, explain bool) (*FuzzySearcher, error) {
// Note: we don't byte slice the term for a prefix because of runes.
prefixTerm := ""
for i, r := range term {
if i < prefix {
prefixTerm += string(r)
} else {
break
}
}