Upgrade bleve from v2.0.6 to v2.3.0 (#18132)

This commit is contained in:
Lunny Xiao
2022-01-01 16:26:27 +08:00
committed by GitHub
parent 1a4e2bfcd1
commit 25a290e320
70 changed files with 1283 additions and 660 deletions

View File

@@ -123,9 +123,15 @@ OUTER:
// if there were no terms to highlight
// produce a single fragment from the beginning
start := 0
end := start + s.fragmentSize
if end > len(orig) {
end = len(orig)
end := start
used := 0
for end < len(orig) && used < s.fragmentSize {
r, size := utf8.DecodeRune(orig[end:])
if r == utf8.RuneError {
break
}
end += size
used++
}
rv = append(rv, &highlight.Fragment{Orig: orig, Start: start, End: end})
}