0
0
Fork 0

scorch optimize mem processDocument() dict access

This change moves the dict lookup to outside of the loop.
This commit is contained in:
Steve Yen 2018-03-03 11:43:22 -08:00
parent 88c740095b
commit b7cfef81c9
1 changed files with 2 additions and 1 deletions

View File

@ -252,8 +252,9 @@ func (s *Segment) processDocument(result *index.AnalysisResult) {
// now that its been rolled up into docMap, walk that
for fieldID, tokenFrequencies := range docMap {
dict := s.Dicts[fieldID]
for term, tokenFreq := range tokenFrequencies {
pid := s.Dicts[fieldID][term] - 1
pid := dict[term] - 1
bs := s.Postings[pid]
bs.AddInt(int(docNum))
s.Freqs[pid] = append(s.Freqs[pid], uint64(tokenFreq.Frequency()))