0
0
Fork 0

fix postings list count impl

This commit is contained in:
Marty Schoch 2017-12-12 08:42:13 -05:00
parent 3873237e46
commit 927216df8c
1 changed files with 3 additions and 10 deletions

View File

@ -85,20 +85,13 @@ func (p *PostingsList) Iterator() segment.PostingsIterator {
// Count returns the number of items on this postings list
func (p *PostingsList) Count() uint64 {
var rv uint64
if p.postings != nil {
rv = p.postings.GetCardinality()
if p.except != nil {
except := p.except.GetCardinality()
if except > rv {
// avoid underflow
except = rv
}
rv -= except
return roaring.AndNot(p.postings, p.except).GetCardinality()
}
return p.postings.GetCardinality()
}
return rv
return 0
}
// PostingsIterator provides a way to iterate through the postings list