Skip to content

Commit

Permalink
Merge pull request #96 from blevesearch/bleve#1606_2
Browse files Browse the repository at this point in the history
Move all iterator forward until a match, only if possible
  • Loading branch information
abhinavdangeti committed Dec 16, 2021
2 parents def2407 + 6867593 commit 206e6c2
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 @@ -573,7 +573,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 @@ -597,6 +597,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 206e6c2

Please sign in to comment.