Java Code Examples for org.apache.lucene.index.MultiDocValues#MultiSortedSetDocValues

The following examples show how to use org.apache.lucene.index.MultiDocValues#MultiSortedSetDocValues . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/** 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);
  }
}
 
Example 2
/** 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);
  }
}
 
Example 3
/** Does all the "real work" of tallying up the counts. */
private final void count(List<MatchingDocs> matchingDocs) throws IOException, InterruptedException {

  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();
  List<Future<Void>> results = new ArrayList<>();

  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");
    }
    
    results.add(exec.submit(new CountOneSegment(hits.context.reader(), hits, ordinalMap, hits.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);
    }
  }
}
 
Example 4
/** 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);
    }
  }
}
 
Example 5
@Override
public void resetIterators() throws IOException {
  topLevel = FieldUtil.getSortedSetDocValues(fcontext.qcontext, field, null);
  nTerms = (int) topLevel.getValueCount();
  if (topLevel instanceof MultiDocValues.MultiSortedSetDocValues) {
    ordMap = ((MultiDocValues.MultiSortedSetDocValues) topLevel).mapping;
    subDvs = ((MultiDocValues.MultiSortedSetDocValues) topLevel).values;
  } else {
    ordMap = null;
    subDvs = null;
  }
}
 
Example 6
Source Project: lucene-solr   File: MinMaxAgg.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void resetIterators() throws IOException {
  super.resetIterators();
  topLevel = FieldUtil.getSortedSetDocValues(fcontext.qcontext, sf, null);
  if (topLevel instanceof MultiDocValues.MultiSortedSetDocValues) {
    ordMap = ((MultiDocValues.MultiSortedSetDocValues)topLevel).mapping;
    subDvs = ((MultiDocValues.MultiSortedSetDocValues)topLevel).values;
  } else {
    ordMap = null;
    subDvs = null;
  }
}