Skip to content

Commit

Permalink
implement visit interator
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Apr 19, 2024
1 parent cadf974 commit 56993d5
Showing 1 changed file with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,9 @@ public void visit(int docID) throws IOException {
@Override
public void visit(DocIdSetIterator iterator) throws IOException {
logger.debug("visit iterator");
// int count = 0;
// for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
// count++;
// }
// for (long[] range : ranges) {
// incrementDocCount.accept(fieldType.convertNanosToMillis(range[0]), count);
// }
for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
collector.count();
}
}

@Override
Expand All @@ -836,17 +832,20 @@ public void visit(int docID, byte[] packedValue) throws IOException {
@Override
public void visit(DocIdSetIterator iterator, byte[] packedValue) throws IOException {
logger.debug("visit iterator with packedValue");
// int count = 0;
// for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
// count++;
// }
// long value = NumericUtils.sortableBytesToLong(packedValue, 0);
// // System.out.println("value" + value + " count=" + count);
// for (long[] range : ranges) {
// if (value >= range[0] && value <= range[1]) {
// incrementDocCount.accept(fieldType.convertNanosToMillis(range[0]), count);
// }
// }
long value = NumericUtils.sortableBytesToLong(packedValue, 0);
// System.out.println("value" + value + " count=" + count);
if (value > collector.activeRange[1]) {
collector.finalizePreviousRange();

if (!collector.goToNextRange(value)) {
return;
}
}
if (value >= collector.activeRange[0] && value <= collector.activeRange[1]) {
for (int doc = iterator.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iterator.nextDoc()) {
collector.count();
}
}
}

@Override
Expand Down

0 comments on commit 56993d5

Please sign in to comment.