Java Code Examples for org.apache.lucene.search.spans.Spans#asTwoPhaseIterator()

The following examples show how to use org.apache.lucene.search.spans.Spans#asTwoPhaseIterator() . 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: DisiWrapper.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public DisiWrapper(Spans spans) {
  this.scorer = null;
  this.spans = spans;
  this.iterator = spans;
  this.cost = iterator.cost();
  this.doc = -1;
  this.twoPhaseView = spans.asTwoPhaseIterator();
    
  if (twoPhaseView != null) {
    approximation = twoPhaseView.approximation();
    matchCost = twoPhaseView.matchCost();
  } else {
    approximation = iterator;
    matchCost = 0f;
  }
  this.lastApproxNonMatchDoc = -2;
  this.lastApproxMatchDoc = -2;
}
 
Example 2
Source File: ConjunctionDISI.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** Adds the Spans. */
private static void addSpans(Spans spans, List<DocIdSetIterator> allIterators, List<TwoPhaseIterator> twoPhaseIterators) {
  TwoPhaseIterator twoPhaseIter = spans.asTwoPhaseIterator();
  if (twoPhaseIter != null) {
    addTwoPhaseIterator(twoPhaseIter, allIterators, twoPhaseIterators);
  } else { // no approximation support, use the iterator as-is
    addIterator(spans, allIterators, twoPhaseIterators);
  }
}