List of usage examples for org.apache.lucene.search.spans Spans positionsCost
public abstract float positionsCost();
From source file:uk.co.flax.luwak.util.XConjunctionSpans.java
License:Apache License
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. *///w w w . ja va2 s.c o m @Override public TwoPhaseIterator asTwoPhaseIterator() { float totalMatchCost = 0; // Compute the matchCost as the total matchCost/positionsCostant of the sub spans. for (Spans spans : subSpans) { TwoPhaseIterator tpi = spans.asTwoPhaseIterator(); if (tpi != null) { totalMatchCost += tpi.matchCost(); } else { totalMatchCost += spans.positionsCost(); } } final float matchCost = totalMatchCost; return new TwoPhaseIterator(conjunction) { @Override public boolean matches() throws IOException { return twoPhaseCurrentDocMatches(); } @Override public float matchCost() { return matchCost; } }; }