Browse Source

Include freq/norm if location information is asked for

abhinavdangeti 2 months ago
parent
commit
409d4e4fc3
2 changed files with 2 additions and 2 deletions
  1. 1 1
      index/scorch/segment/zap/posting.go
  2. 1 1
      search/searcher/search_term.go

+ 1 - 1
index/scorch/segment/zap/posting.go

@@ -190,7 +190,7 @@ func (p *PostingsList) iterator(includeFreq, includeNorm, includeLocs bool,
 	}
 
 	rv.postings = p
-	rv.includeFreqNorm = includeFreq || includeNorm
+	rv.includeFreqNorm = includeFreq || includeNorm || includeLocs
 	rv.includeLocs = includeLocs
 
 	if p.normBits1Hit != 0 {

+ 1 - 1
search/searcher/search_term.go

@@ -42,7 +42,7 @@ func NewTermSearcher(indexReader index.IndexReader, term string, field string, b
 }
 
 func NewTermSearcherBytes(indexReader index.IndexReader, term []byte, field string, boost float64, options search.SearcherOptions) (*TermSearcher, error) {
-	needFreqNorm := options.IncludeTermVectors || options.Score != "none"
+	needFreqNorm := options.Score != "none"
 	reader, err := indexReader.TermFieldReader(term, field, needFreqNorm, needFreqNorm, options.IncludeTermVectors)
 	if err != nil {
 		return nil, err