Skip to content

Commit 51909c7

Browse files
committed
Removing nextOrd() call and directly traversing over valid range for SortedSetDocValues
Signed-off-by: Tanik Pansuriya <[email protected]>
1 parent 0e81c7a commit 51909c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server/src/main/java/org/opensearch/index/mapper/SortedSetDocValuesFetcher.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public List<Object> fetch(LeafReader reader, int docId) throws IOException {
3838
return values;
3939
}
4040
int valueCount = sortedSetDocValues.docValueCount();
41-
for (long ord = sortedSetDocValues.nextOrd(), i = 0; ord != SortedSetDocValues.NO_MORE_DOCS && i < valueCount; ord =
42-
sortedSetDocValues.nextOrd(), i++) {
41+
// docValueCount() is equivalent to one plus the maximum ordinal, that means ordinal
42+
// range is [0, docValueCount() - 1]
43+
for (int ord = 0; ord < valueCount; ord++) {
4344
BytesRef value = sortedSetDocValues.lookupOrd(ord);
4445
values.add(BytesRef.deepCopyOf(value));
4546
}

0 commit comments

Comments
 (0)