void computePositionsCost() { float sumPositionsCost = 0; long sumCost = 0; for (DisiWrapper w : byDocQueue) { long costWeight = (w.cost <= 1) ? 1 : w.cost; sumPositionsCost += w.spans.positionsCost() * costWeight; sumCost += costWeight; } positionsCost = sumPositionsCost / sumCost; }
@Override public float matchCost() { return in.positionsCost(); // overestimate }
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. */ @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; } }; }
void computePositionsCost() { float sumPositionsCost = 0; long sumCost = 0; for (DisiWrapper w : byDocQueue) { long costWeight = (w.cost <= 1) ? 1 : w.cost; sumPositionsCost += w.spans.positionsCost() * costWeight; sumCost += costWeight; } positionsCost = sumPositionsCost / sumCost; }
@Override public float positionsCost() { return in.positionsCost(); } }
void computePositionsCost() { float sumPositionsCost = 0; long sumCost = 0; for (DisiWrapper w : byDocQueue) { long costWeight = (w.cost <= 1) ? 1 : w.cost; sumPositionsCost += w.spans.positionsCost() * costWeight; sumCost += costWeight; } positionsCost = sumPositionsCost / sumCost; }
@Override public float matchCost() { return in.positionsCost(); // overestimate }
@Override public float positionsCost() { return in.positionsCost(); }
@Override public float matchCost() { return in.positionsCost(); // overestimate }
void computePositionsCost() { float sumPositionsCost = 0; long sumCost = 0; for (DisiWrapper w : byDocQueue) { long costWeight = (w.cost <= 1) ? 1 : w.cost; sumPositionsCost += w.spans.positionsCost() * costWeight; sumCost += costWeight; } positionsCost = sumPositionsCost / sumCost; }
void computePositionsCost() { float sumPositionsCost = 0; long sumCost = 0; for (DisiWrapper w: byDocQueue) { long costWeight = (w.cost <= 1) ? 1 : w.cost; sumPositionsCost += w.spans.positionsCost() * costWeight; sumCost += costWeight; } positionsCost = sumPositionsCost / sumCost; }
@Override public float matchCost() { return in.positionsCost(); // overestimate }
@Override public float positionsCost() { return in.positionsCost(); } }
@Override public float positionsCost() { return source.positionsCost(); }
@Override public float positionsCost() { return in.positionsCost(); }
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. */ @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; } }; }
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. */ @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; } }; }
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. */ @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; } }; }
/** * Return a {@link TwoPhaseIterator} view of this ConjunctionSpans. */ @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; } }; }