Merge pull request #476 from steveyen/optimize-fuzzy-searcher-prefixTerm-loop
end fuzzy searcher prefixTerm construction loop early
This commit is contained in:
commit
ac02b206e5
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user