diff --git a/search.go b/search.go index a9d00b935..aced23f75 100644 --- a/search.go +++ b/search.go @@ -600,11 +600,11 @@ func MemoryNeededForSearchResult(req *SearchRequest) uint64 { estimate += len(req.Facets) * fr.Size() } - // highlighting, store + // overhead from highlighting, store var d document.Document if len(req.Fields) > 0 || req.Highlight != nil { - for i := 0; i < (req.Size + req.From); i++ { - estimate += (req.Size + req.From) * d.Size() + for i := 0; i < numDocMatches; i++ { + estimate += numDocMatches * d.Size() } }