0
0
Fork 0

completely avoid dynamic dispatch if only sorting on score

This commit is contained in:
Marty Schoch 2016-08-25 22:59:08 -04:00
parent 127f37212b
commit 931ec677c4
1 changed files with 3 additions and 1 deletions

View File

@ -146,7 +146,9 @@ func (hc *HeapCollector) collectSingle(ctx *search.SearchContext, reader index.I
}
// compute this hits sort value
hc.sort.Value(d)
if len(hc.sort) > 1 || len(hc.sort) == 1 && !hc.cachedScoring[0] {
hc.sort.Value(d)
}
// optimization, we track lowest sorting hit already removed from heap
// with this one comparision, we can avoid all heap operations if