Skip to content

Commit

Permalink
Revert "Added missing part of 7830 for facetprocessor"
Browse files Browse the repository at this point in the history
This reverts commit 83acba2.
  • Loading branch information
Steve Mason committed Oct 30, 2020
1 parent a12cd59 commit ed4a196
Showing 1 changed file with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ void resetStats() throws IOException {
}

int collect(DocSet docs, int slot, IntFunction<SlotContext> slotContext) throws IOException {
int count = 0;
SolrIndexSearcher searcher = fcontext.searcher;

if (0 == docs.size()) {
// we may be in a "processEmpty" type situation where the client still cares about this bucket
// either way, we should let our accumulators know about the empty set, so they can collect &
Expand All @@ -344,8 +347,35 @@ int collect(DocSet docs, int slot, IntFunction<SlotContext> slotContext) throws
acc.collect(docs, slot, slotContext); // NOT per-seg collectors
}
}
return count;
}

final List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
final Iterator<LeafReaderContext> ctxIt = leaves.iterator();
LeafReaderContext ctx = null;
int segBase = 0;
int segMax;
int adjustedMax = 0;
for (DocIterator docsIt = docs.iterator(); docsIt.hasNext(); ) {
final int doc = docsIt.nextDoc();
if (doc >= adjustedMax) {
do {
ctx = ctxIt.next();
if (ctx == null) {
// should be impossible
throw new RuntimeException("INTERNAL FACET ERROR");
}
segBase = ctx.docBase;
segMax = ctx.reader().maxDoc();
adjustedMax = segBase + segMax;
} while (doc >= adjustedMax);
assert doc >= ctx.docBase;
setNextReader(ctx);
}
count++;
collect(doc - segBase, slot, slotContext); // per-seg collectors
}
return docs.size();
return count;
}

void collect(int segDoc, int slot, IntFunction<SlotContext> slotContext) throws IOException {
Expand Down

0 comments on commit ed4a196

Please sign in to comment.