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; return func;
} }
@Override
public Query rewrite(IndexReader reader) throws IOException { public Query rewrite(IndexReader reader) throws IOException {
return this; return this;
} }
@Override
public void extractTerms(Set terms) {} public void extractTerms(Set terms) {}
protected class FunctionWeight extends Weight { protected class FunctionWeight extends Weight {
@ -69,10 +71,12 @@ public class FunctionQuery extends Query {
func.createWeight(context, searcher); func.createWeight(context, searcher);
} }
@Override
public Query getQuery() { public Query getQuery() {
return FunctionQuery.this; return FunctionQuery.this;
} }
@Override
public float getValue() { public float getValue() {
return queryWeight; return queryWeight;
} }
@ -132,11 +136,11 @@ public class FunctionQuery extends Query {
return doc; return doc;
} }
@Override
// instead of matching all docs, we could also embed a query. // instead of matching all docs, we could also embed a query.
// the score could either ignore the subscore, or boost it. // the score could either ignore the subscore, or boost it.
// Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f) // Containment: floatline(foo:myTerm, "myFloatField", 1.0, 0.0f)
// Boost: foo:myTerm^floatline("myFloatField",1.0,0.0f) // Boost: foo:myTerm^floatline("myFloatField",1.0,0.0f)
@Override
public int nextDoc() throws IOException { public int nextDoc() throws IOException {
for(;;) { for(;;) {
++doc; ++doc;
@ -155,29 +159,7 @@ public class FunctionQuery extends Query {
return nextDoc(); return nextDoc();
} }
// instead of matching all docs, we could also embed a query. @Override
// 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;
}
public float score() throws IOException { public float score() throws IOException {
float score = qWeight * vals.floatVal(doc); float score = qWeight * vals.floatVal(doc);
@ -187,11 +169,6 @@ public class FunctionQuery extends Query {
return score>Float.NEGATIVE_INFINITY ? score : -Float.MAX_VALUE; 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 { public Explanation explain(int doc) throws IOException {
float sc = qWeight * vals.floatVal(doc); float sc = qWeight * vals.floatVal(doc);
@ -206,12 +183,14 @@ public class FunctionQuery extends Query {
} }
@Override
public Weight createWeight(Searcher searcher) throws IOException { public Weight createWeight(Searcher searcher) throws IOException {
return new FunctionQuery.FunctionWeight(searcher); return new FunctionQuery.FunctionWeight(searcher);
} }
/** Prints a user-readable version of this query. */ /** Prints a user-readable version of this query. */
@Override
public String toString(String field) public String toString(String field)
{ {
float boost = getBoost(); float boost = getBoost();
@ -221,6 +200,7 @@ public class FunctionQuery extends Query {
/** Returns true if <code>o</code> is equal to this. */ /** Returns true if <code>o</code> is equal to this. */
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (FunctionQuery.class != o.getClass()) return false; if (FunctionQuery.class != o.getClass()) return false;
FunctionQuery other = (FunctionQuery)o; FunctionQuery other = (FunctionQuery)o;
@ -229,6 +209,7 @@ public class FunctionQuery extends Query {
} }
/** Returns a hash code value for this object. */ /** Returns a hash code value for this object. */
@Override
public int hashCode() { public int hashCode() {
return func.hashCode()*31 + Float.floatToIntBits(getBoost()); return func.hashCode()*31 + Float.floatToIntBits(getBoost());
} }