Methods Summary |
---|
private boolean | doNext()
while (more) {
while (more && first.doc < last.doc) { // find doc w/ all the terms
more = first.skipTo(last.doc); // skip first upto last
firstToLast(); // and move it to the end
}
if (more) {
// found a doc with all of the terms
freq = phraseFreq(); // check for phrase
if (freq == 0.0f) // no match
more = last.next(); // trigger further scanning
else
return true; // found a match
}
}
return false; // no more matches
|
public int | doc() return first.doc;
|
public org.apache.lucene.search.Explanation | explain(int doc)
Explanation tfExplanation = new Explanation();
while (next() && doc() < doc) {}
float phraseFreq = (doc() == doc) ? freq : 0.0f;
tfExplanation.setValue(getSimilarity().tf(phraseFreq));
tfExplanation.setDescription("tf(phraseFreq=" + phraseFreq + ")");
return tfExplanation;
|
protected final void | firstToLast()
last.next = first; // move first to end of list
last = first;
first = first.next;
last.next = null;
|
private void | init()
for (PhrasePositions pp = first; more && pp != null; pp = pp.next)
more = pp.next();
if(more)
sort();
|
public boolean | next()
if (firstTime) {
init();
firstTime = false;
} else if (more) {
more = last.next(); // trigger further scanning
}
return doNext();
|
protected abstract float | phraseFreq()
|
protected final void | pqToList()
last = first = null;
while (pq.top() != null) {
PhrasePositions pp = (PhrasePositions) pq.pop();
if (last != null) { // add next to end of list
last.next = pp;
} else
first = pp;
last = pp;
pp.next = null;
}
|
public float | score()
//System.out.println("scoring " + first.doc);
float raw = getSimilarity().tf(freq) * value; // raw score
return raw * Similarity.decodeNorm(norms[first.doc]); // normalize
|
public boolean | skipTo(int target)
for (PhrasePositions pp = first; more && pp != null; pp = pp.next) {
more = pp.skipTo(target);
}
if (more)
sort(); // re-sort
return doNext();
|
private void | sort()
pq.clear();
for (PhrasePositions pp = first; pp != null; pp = pp.next)
pq.put(pp);
pqToList();
|
public java.lang.String | toString() return "scorer(" + weight + ")";
|