Skip to content

Commit

Permalink
Merge pull request blevesearch#104 from abhinavdangeti/v11.x
Browse files Browse the repository at this point in the history
[v11] Move all iterator forward until a match, only if possible
  • Loading branch information
abhinavdangeti committed Dec 16, 2021
2 parents f18bb30 + eeb4160 commit b1a9b6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion posting.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func (i *PostingsIterator) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool,

i.Actual.AdvanceIfNeeded(uint32(atOrAfter))

if !i.Actual.HasNext() {
if !i.Actual.HasNext() || !i.all.HasNext() {
// couldn't find anything
return 0, false, nil
}
Expand All @@ -693,6 +693,10 @@ func (i *PostingsIterator) nextDocNumAtOrAfter(atOrAfter uint64) (uint64, bool,
}
}

if !i.all.HasNext() {
return 0, false, nil
}

allN = i.all.Next()
}

Expand Down

0 comments on commit b1a9b6f

Please sign in to comment.