void collect(int segDoc, int slot) throws IOException { if (accs != null) { for (SlotAcc acc : accs) { acc.collect(segDoc, slot); } } }
void addStats(SimpleOrderedMap<Object> target, int slotNum) throws IOException { int count = countAcc.getCount(slotNum); target.add("count", count); if (count > 0 || freq.processEmpty) { for (SlotAcc acc : accs) { acc.setValues(target, slotNum); } } }
protected void createAccs(int docCount, int slotCount) throws IOException { accMap = new LinkedHashMap<>(); // allow a custom count acc to be used if (countAcc == null) { countAcc = new CountSlotArrAcc(fcontext, slotCount); countAcc.key = "count"; } for (Map.Entry<String, AggValueSource> entry : freq.getFacetStats().entrySet()) { SlotAcc acc = entry.getValue().createSlotAcc(fcontext, docCount, slotCount); acc.key = entry.getKey(); accMap.put(acc.key, acc); } accs = new SlotAcc[accMap.size()]; int i = 0; for (SlotAcc acc : accMap.values()) { accs[i++] = acc; } }
void setNextReader(LeafReaderContext ctx) throws IOException { // countAcc.setNextReader is a no-op for (SlotAcc acc : accs) { acc.setNextReader(ctx); } }
// note: only called by enum/stream prior to collect void resetStats() { countAcc.reset(); for (SlotAcc acc : accs) { acc.reset(); } }