@Override public BinaryDocValues getBinaryDocValues(String field) throws IOException { if (facetFields.contains(field)) { final OrdinalsReader ordsReader = getOrdinalsReader(field); return new OrdinalMappingBinaryDocValues(ordsReader.getReader(in.getContext())); } else { return in.getBinaryDocValues(field); } }
private final void count(List<MatchingDocs> matchingDocs) throws IOException { IntsRef scratch = new IntsRef(); for (MatchingDocs hits : matchingDocs) { OrdinalsReader.OrdinalsSegmentReader ords = ordinalsReader.getReader(hits.context); DocIdSetIterator docs = hits.bits.iterator(); int doc; while ((doc = docs.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { ords.get(doc, scratch); for (int i = 0; i < scratch.length; i++) { values[scratch.ints[scratch.offset + i]]++; } } } rollup(); }