remove obsolete scorer methods, add @Override

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1000685 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-09-24 01:17:28 +00:00
parent d46262e373
commit 5bdde9b1d3
1 changed files with 10 additions and 29 deletions

View File

@ -51,10 +51,12 @@ public class FunctionQuery extends Query {
return func;
}
@Override
public Query rewrite(IndexReader reader) throws IOException {
return this;
}
@Override
public void extractTerms(Set terms) {}
protected class FunctionWeight extends Weight {
@ -69,10 +71,12 @@ public class FunctionQuery extends Query {
func.createWeight(context, searcher);
}
@Override
public Query getQuery() {
return FunctionQuery.this;
}
@Override
public float getValue() {
return queryWeight;
}
@ -132,11 +136,11 @@ public class FunctionQuery extends Query {
return doc;
}
@Override
// instead of matching all docs, we could also embed a query.
// the score could either ignore the subscore, or boost it.
// Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
// Boost: foo:myTerm^floatline("myFloatField",1.0,0.0f)
@Override
public int nextDoc() throws IOException {
for(;;) {
++doc;
@ -155,29 +159,7 @@ public class FunctionQuery extends Query {
return nextDoc();
}
// instead of matching all docs, we could also embed a query.
// the score could either ignore the subscore, or boost it.
// Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
// Boost: foo:myTerm^floatline("myFloatField",1.0,0.0f)
public boolean next() throws IOException {
for(;;) {
++doc;
if (doc>=maxDoc) {
return false;
}
if (hasDeletions && delDocs.get(doc)) continue;
// todo: maybe allow score() to throw a specific exception
// and continue on to the next document if it is thrown...
// that may be useful, but exceptions aren't really good
// for flow control.
return true;
}
}
public int doc() {
return doc;
}
@Override
public float score() throws IOException {
float score = qWeight * vals.floatVal(doc);
@ -187,11 +169,6 @@ public class FunctionQuery extends Query {
return score>Float.NEGATIVE_INFINITY ? score : -Float.MAX_VALUE;
}
public boolean skipTo(int target) throws IOException {
doc=target-1;
return next();
}
public Explanation explain(int doc) throws IOException {
float sc = qWeight * vals.floatVal(doc);
@ -206,12 +183,14 @@ public class FunctionQuery extends Query {
}
@Override
public Weight createWeight(Searcher searcher) throws IOException {
return new FunctionQuery.FunctionWeight(searcher);
}
/** Prints a user-readable version of this query. */
@Override
public String toString(String field)
{
float boost = getBoost();
@ -221,6 +200,7 @@ public class FunctionQuery extends Query {
/** Returns true if <code>o</code> is equal to this. */
@Override
public boolean equals(Object o) {
if (FunctionQuery.class != o.getClass()) return false;
FunctionQuery other = (FunctionQuery)o;
@ -229,6 +209,7 @@ public class FunctionQuery extends Query {
}
/** Returns a hash code value for this object. */
@Override
public int hashCode() {
return func.hashCode()*31 + Float.floatToIntBits(getBoost());
}