Merge pull request #661 from steveyen/scorchReusePosting
scorch reuses Posting instance in PostingsIterator.Next()
This commit is contained in:
commit
20972493d1
|
@ -64,6 +64,10 @@ type PostingsList interface {
|
|||
}
|
||||
|
||||
type PostingsIterator interface {
|
||||
// The caller is responsible for copying whatever it needs from
|
||||
// the returned Posting instance before calling Next(), as some
|
||||
// implementations may return a shared instance to reduce memory
|
||||
// allocations.
|
||||
Next() (Posting, error)
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ type PostingsIterator struct {
|
|||
locChunkStart uint64
|
||||
|
||||
locBitmap *roaring.Bitmap
|
||||
|
||||
next Posting
|
||||
}
|
||||
|
||||
func (i *PostingsIterator) loadChunk(chunk int) error {
|
||||
|
@ -266,10 +268,10 @@ func (i *PostingsIterator) Next() (segment.Posting, error) {
|
|||
}
|
||||
}
|
||||
|
||||
rv := &Posting{
|
||||
iterator: i,
|
||||
docNum: uint64(n),
|
||||
}
|
||||
i.next = Posting{} // clear the struct.
|
||||
rv := &i.next
|
||||
rv.iterator = i
|
||||
rv.docNum = uint64(n)
|
||||
|
||||
var err error
|
||||
var normBits uint64
|
||||
|
|
Loading…
Reference in New Issue