org.apache.lucene.search.ConjunctionDISI Java Examples

The following examples show how to use org.apache.lucene.search.ConjunctionDISI. 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
Source File: LongValueFacetCounts.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private void countOneSegment(NumericDocValues values, MatchingDocs hits) throws IOException {
  DocIdSetIterator it = ConjunctionDISI.intersectIterators(
                           Arrays.asList(hits.bits.iterator(), values));

  for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) {
    increment(values.longValue());
    totCount++;
  }
}
 
Example #2
Source File: LongValueFacetCounts.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** Counts directly from SortedNumericDocValues. */
private void countMultiValued(String field, List<MatchingDocs> matchingDocs) throws IOException {

  for (MatchingDocs hits : matchingDocs) {
    SortedNumericDocValues values = hits.context.reader().getSortedNumericDocValues(field);
    if (values == null) {
      // this field has no doc values for this segment
      continue;
    }

    NumericDocValues singleValues = DocValues.unwrapSingleton(values);

    if (singleValues != null) {
      countOneSegment(singleValues, hits);
    } else {

      DocIdSetIterator it = ConjunctionDISI.intersectIterators(
                               Arrays.asList(hits.bits.iterator(), values));
    
      for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) {
        int limit = values.docValueCount();
        totCount += limit;
        for (int i = 0; i < limit; i++) {
          increment(values.nextValue());
        }
      }
    }
  }
}
 
Example #3
Source File: ConjunctionSpans.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
ConjunctionSpans(List<Spans> subSpans) {
  if (subSpans.size() < 2) {
    throw new IllegalArgumentException("Less than 2 subSpans.size():" + subSpans.size());
  }
  this.subSpans = subSpans.toArray(new Spans[subSpans.size()]);
  this.conjunction = ConjunctionDISI.intersectSpans(subSpans);
  this.atFirstInCurrentDoc = true; // ensure for doc -1 that start/end positions are -1
}
 
Example #4
Source File: CustomConjunctionSpans.java    From pyramid with Apache License 2.0 5 votes vote down vote up
CustomConjunctionSpans(List<Spans> subSpans) {
    if (subSpans.size() < 2) {
        throw new IllegalArgumentException("Less than 2 subSpans.size():" + subSpans.size());
    }
    this.subSpans = subSpans.toArray(new Spans[subSpans.size()]);
    this.conjunction = ConjunctionDISI.intersectSpans(subSpans);
    this.atFirstInCurrentDoc = true; // ensure for doc -1 that start/end positions are -1
}
 
Example #5
Source File: ToParentDocValues.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private ToParentDocValues(DocIdSetIterator values, BitSet parents, DocIdSetIterator children, Accumulator collect) {
  this.parents = parents;
  childWithValues = ConjunctionDISI.intersectIterators(Arrays.asList(children, values));
  this.collector = collect;
}