scorch zap optimize postings itr with tf/loc reader/decoder reuse
This commit is contained in:
parent
530a3d24cf
commit
5b86da85f3
|
@ -45,7 +45,25 @@ func (p *PostingsList) iterator(rv *PostingsIterator) *PostingsIterator {
|
||||||
if rv == nil {
|
if rv == nil {
|
||||||
rv = &PostingsIterator{}
|
rv = &PostingsIterator{}
|
||||||
} else {
|
} else {
|
||||||
|
freqNormReader := rv.freqNormReader
|
||||||
|
if freqNormReader != nil {
|
||||||
|
freqNormReader.Reset([]byte(nil))
|
||||||
|
}
|
||||||
|
freqNormDecoder := rv.freqNormDecoder
|
||||||
|
|
||||||
|
locReader := rv.locReader
|
||||||
|
if locReader != nil {
|
||||||
|
locReader.Reset([]byte(nil))
|
||||||
|
}
|
||||||
|
locDecoder := rv.locDecoder
|
||||||
|
|
||||||
*rv = PostingsIterator{} // clear the struct
|
*rv = PostingsIterator{} // clear the struct
|
||||||
|
|
||||||
|
rv.freqNormReader = freqNormReader
|
||||||
|
rv.freqNormDecoder = freqNormDecoder
|
||||||
|
|
||||||
|
rv.locReader = locReader
|
||||||
|
rv.locDecoder = locDecoder
|
||||||
}
|
}
|
||||||
rv.postings = p
|
rv.postings = p
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue