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