/** Does all the "real work" of tallying up the counts. */ private final void countAll() throws IOException, InterruptedException { //System.out.println("ssdv count"); OrdinalMap ordinalMap; // TODO: is this right? really, we need a way to // verify that this ordinalMap "matches" the leaves in // matchingDocs... if (dv instanceof MultiDocValues.MultiSortedSetDocValues) { ordinalMap = ((MultiSortedSetDocValues) dv).mapping; } else { ordinalMap = null; } List<Future<Void>> results = new ArrayList<>(); for (LeafReaderContext context : state.getReader().leaves()) { results.add(exec.submit(new CountOneSegment(context.reader(), null, ordinalMap, context.ord))); } for (Future<Void> result : results) { try { result.get(); } catch (ExecutionException ee) { // Theoretically cause can be null; guard against that. Throwable cause = ee.getCause(); throw IOUtils.rethrowAlways(cause != null ? cause : ee); } } }
IndexReader reader = state.getReader(); List<Future<Void>> results = new ArrayList<>();
/** Does all the "real work" of tallying up the counts. */ private final void count(List<MatchingDocs> matchingDocs) throws IOException { //System.out.println("ssdv count"); OrdinalMap ordinalMap; // TODO: is this right? really, we need a way to // verify that this ordinalMap "matches" the leaves in // matchingDocs... if (dv instanceof MultiDocValues.MultiSortedSetDocValues && matchingDocs.size() > 1) { ordinalMap = ((MultiSortedSetDocValues) dv).mapping; } else { ordinalMap = null; } IndexReader reader = state.getReader(); for(MatchingDocs hits : matchingDocs) { // LUCENE-5090: make sure the provided reader context "matches" // the top-level reader passed to the // SortedSetDocValuesReaderState, else cryptic // AIOOBE can happen: if (ReaderUtil.getTopLevelContext(hits.context).reader() != reader) { throw new IllegalStateException("the SortedSetDocValuesReaderState provided to this class does not match the reader being searched; you must create a new SortedSetDocValuesReaderState every time you open a new IndexReader"); } countOneSegment(ordinalMap, hits.context.reader(), hits.context.ord, hits); } }
/** Does all the "real work" of tallying up the counts. */ private final void countAll() throws IOException { //System.out.println("ssdv count"); OrdinalMap ordinalMap; // TODO: is this right? really, we need a way to // verify that this ordinalMap "matches" the leaves in // matchingDocs... if (dv instanceof MultiDocValues.MultiSortedSetDocValues) { ordinalMap = ((MultiSortedSetDocValues) dv).mapping; } else { ordinalMap = null; } for(LeafReaderContext context : state.getReader().leaves()) { countOneSegment(ordinalMap, context.reader(), context.ord, null); } }