Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xichen2020 committed Jan 31, 2019
1 parent 771c838 commit efe792e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index/field/multi_field_union_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (it *MultiFieldUnionIterator) DocID() int32 { return it.unionIter.DocID() }
// value array is valid.
func (it *MultiFieldUnionIterator) Values() ([]field.ValueUnion, []bool) {
for i := 0; i < len(it.iters); i++ {
if it.unionIter.IsDoneAt(i) || it.unionIter.DocID() != it.iters[i].DocID() {
if !it.unionIter.IsValidAt(i) {
it.hasVals[i] = false
} else {
it.hasVals[i] = true
Expand Down
7 changes: 4 additions & 3 deletions index/in_any_doc_id_set_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ func (it *InAnyDocIDSetIterator) DocID() int32 {
return it.docIDs[it.minDocIDIdx]
}

// IsDoneAt returns whether the iterator at a given index is done.
func (it *InAnyDocIDSetIterator) IsDoneAt(idx int) bool {
return it.docIDs[idx] == invalidDocID
// IsValidAt returns true if the base iterator at a given index has the same doc ID
// as the current doc ID of the `InAnyDocIDSetIterator`.
func (it *InAnyDocIDSetIterator) IsValidAt(idx int) bool {
return it.docIDs[idx] != invalidDocID && it.docIDs[idx] == it.DocID()
}

// Err returns any errors encountered.
Expand Down

0 comments on commit efe792e

Please sign in to comment.