fix bug in simple highlighter
when requesting highligh of a field with matches would crash
This commit is contained in:
parent
2c86a731b4
commit
1fac31ac9c
@ -75,8 +75,9 @@ func (s *SimpleHighlighter) BestFragmentsInField(dm *DocumentMatch, doc *documen
|
||||
|
||||
// now find the N best non-overlapping fragments
|
||||
bestFragments := make([]*Fragment, 0)
|
||||
if len(fq) > 0 {
|
||||
candidate := heap.Pop(&fq)
|
||||
OUTER:
|
||||
OUTER:
|
||||
for candidate != nil && len(bestFragments) < num {
|
||||
// see if this overlaps with any of the best already identified
|
||||
if len(bestFragments) > 0 {
|
||||
@ -99,6 +100,7 @@ OUTER:
|
||||
}
|
||||
candidate = heap.Pop(&fq)
|
||||
}
|
||||
}
|
||||
|
||||
// now that we have the best fragments, we can format them
|
||||
formattedFragments := make([]string, len(bestFragments))
|
||||
|
Loading…
Reference in New Issue
Block a user