From 60fc8c0b7a5e8016cee7948c736247b40418db0f Mon Sep 17 00:00:00 2001 From: Sreekanth Sivasankaran Date: Fri, 31 Jul 2020 14:27:46 +0530 Subject: [PATCH] Adding norm decoding logic in TermFieldDoc initialisations --- index/scorch/snapshot_index_tfr.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index/scorch/snapshot_index_tfr.go b/index/scorch/snapshot_index_tfr.go index 61537fc4f..f9c4bf12b 100644 --- a/index/scorch/snapshot_index_tfr.go +++ b/index/scorch/snapshot_index_tfr.go @@ -17,6 +17,7 @@ package scorch import ( "bytes" "fmt" + "math" "reflect" "sync/atomic" @@ -100,7 +101,11 @@ func (i *IndexSnapshotTermFieldReader) postingToTermFieldDoc(next segment.Postin rv.Freq = next.Frequency() } if i.includeNorm { - rv.Norm = next.Norm() + if i.snapshot.parent.segPlugin.Version() >= 15 { + rv.Norm = float64(1.0 / math.Sqrt(float64(next.Norm()))) + } else { + rv.Norm = next.Norm() + } } if i.includeTermVectors { locs := next.Locations()