remove obsolete scorer methods, add @Override

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1000683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-09-24 01:08:23 +00:00
parent 791d14061b
commit d46262e373
1 changed files with 14 additions and 4 deletions

View File

@ -66,28 +66,34 @@ public class SolrConstantScoreQuery extends ConstantScoreQuery {
((SolrFilter)filter).createWeight(context, searcher);
}
@Override
public Query getQuery() {
return SolrConstantScoreQuery.this;
}
@Override
public float getValue() {
return queryWeight;
}
@Override
public float sumOfSquaredWeights() throws IOException {
queryWeight = getBoost();
return queryWeight * queryWeight;
}
@Override
public void normalize(float norm) {
this.queryNorm = norm;
queryWeight *= this.queryNorm;
}
@Override
public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder, boolean topScorer) throws IOException {
return new ConstantScorer(similarity, reader, this);
}
@Override
public Explanation explain(IndexReader reader, int doc) throws IOException {
ConstantScorer cs = new ConstantScorer(similarity, reader, this);
@ -133,27 +139,28 @@ public class SolrConstantScoreQuery extends ConstantScoreQuery {
}
}
@Override
public int nextDoc() throws IOException {
return docIdSetIterator.nextDoc();
}
@Override
public int docID() {
return docIdSetIterator.docID();
}
@Override
public float score() throws IOException {
return theScore;
}
@Override
public int advance(int target) throws IOException {
return docIdSetIterator.advance(target);
}
public Explanation explain(int doc) throws IOException {
throw new UnsupportedOperationException();
}
}
@Override
public Weight createWeight(Searcher searcher) {
try {
return new SolrConstantScoreQuery.ConstantWeight(searcher);
@ -164,12 +171,14 @@ public class SolrConstantScoreQuery extends ConstantScoreQuery {
}
/** Prints a user-readable version of this query. */
@Override
public String toString(String field) {
return "ConstantScore(" + filter.toString()
+ (getBoost()==1.0 ? ")" : "^" + getBoost());
}
/** Returns true if <code>o</code> is equal to this. */
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SolrConstantScoreQuery)) return false;
@ -178,6 +187,7 @@ public class SolrConstantScoreQuery extends ConstantScoreQuery {
}
/** Returns a hash code value for this object. */
@Override
public int hashCode() {
// Simple add is OK since no existing filter hashcode has a float component.
return filter.hashCode() + Float.floatToIntBits(getBoost());