public float score() throws IOException { float raw = getSimilarity().tf(freq) * value; // raw score return raw * Similarity.decodeNorm(norms[doc]); // normalize }
public float score() throws IOException { float raw = getSimilarity().tf(freq) * value; // raw score return raw * Similarity.decodeNorm(norms[doc]); // normalize }
public float score() throws IOException { float raw = getSimilarity().tf(freq) * value; // raw score return raw * Similarity.decodeNorm(norms[doc]); // normalize }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
protected boolean setFreqCurrentDoc() throws IOException { if (! more) { return false; } doc = spans.doc(); freq = 0.0f; do { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } while (more && (doc == spans.doc())); return true; }
public Explanation explain(final int doc) throws IOException { Explanation tfExplanation = new Explanation(); skipTo(doc); float phraseFreq = (doc() == doc) ? freq : 0.0f; tfExplanation.setValue(getSimilarity().tf(phraseFreq)); tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")"); return tfExplanation; }
protected boolean setFreqCurrentDoc() throws IOException { if (! more) { return false; } doc = spans.doc(); freq = 0.0f; do { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } while (more && (doc == spans.doc())); return true; }
public boolean skipTo(int target) throws IOException { more = spans.skipTo(target); if (!more) return false; freq = 0.0f; doc = spans.doc(); while (more && spans.doc() == target) { freq += getSimilarity().sloppyFreq(spans.end() - spans.start()); more = spans.next(); } return more || freq != 0.0f; }
public boolean next() throws IOException { if (firstTime) { more = spans.next(); firstTime = false; } if (!more) return false; freq = 0.0f; doc = spans.doc(); while (more && doc == spans.doc()) { int matchLength = spans.end() - spans.start(); freq += getSimilarity().sloppyFreq(matchLength); more = spans.next(); } return more || freq != 0.0f; }