@Override public float scoreInNode() throws IOException { return parentSpans.scoreInNode(); }
@Override public float scoreInNode() throws IOException { return spans.scoreInNode(); }
@Override public float scoreInNode() throws IOException { return includeSpans.scoreInNode(); }
protected void computeScoreAndFreq() throws IOException { numMatches = 0; scoreInNode = 0.0f; // we have already called one time #nextPosition do { numMatches++; scoreInNode += spans.scoreInNode(); } while (spans.nextPosition()); // set the flag isScoreAndFreqComputed = true; }
@Override public float scoreInNode() throws IOException { float score = 0.0f; // Sum the score of the sub-spans for (int i = 0; i < subSpans.length; i++) { score += subSpans[i].scoreInNode(); } // compute the sloppy weight float sloppyWeight = this.sloppyWeight(this.getSlop()); return score * sloppyWeight; }
public float scoreInNode() throws IOException { // Sum the score of spans, starting from the top, having the same document and node. // Add the score of the top. return this.sumScoreInNode(1) + this.top().scoreInNode(); }
/** * If an optional clause matches, compute the score of the required and optional clause. We need to recompute the * score of the required clause as the sloppy weight might have changed due to the optional match. */ private float getReqOptScore() throws IOException { int totalLength = 0; float score = 0.0f; for (Spans spans : originalRequiredSpans) { totalLength += spans.end() - spans.start(); score += spans.scoreInNode(); } totalLength += optionalSpans.end() - optionalSpans.start(); score += optionalSpans.scoreInNode(); Spans min = optionalSpans.start() < requiredSpans.start() ? optionalSpans : requiredSpans; Spans max = optionalSpans.end() < requiredSpans.end() ? requiredSpans : optionalSpans; int slop = (max.end() - min.start()) - totalLength; return score * this.sloppyWeight(slop); }
/** * Perform a traversal of the heap binary tree using recursion. Given a node, * visit its children and check if their spans is equivalent to the least * spans. If the spans is equivalent, it sums its score for the current node and recursively visit its * two children. */ private final float sumScoreInNode(final int root) throws IOException { float score = 0; final int i1 = (root << 1); // index of first child node final int i2 = i1 + 1; // index of second child node Spans top = this.top(); if (i1 <= this.size()) { final Spans child1 = (Spans) this.getHeapArray()[i1]; if (nodeEqual(top, child1)) { score += child1.scoreInNode(); score += this.sumScoreInNode(i1); } } if (i2 <= this.size()) { final Spans child2 = (Spans) this.getHeapArray()[i2]; if (nodeEqual(top, child2)) { score += child2.scoreInNode(); score += this.sumScoreInNode(i2); } } return score; }
@Override public float scoreInNode() throws IOException { final float reqScore = requiredSpans.scoreInNode(); final int doc = requiredSpans.doc();