Skip to content

Apache Lucene open-source search software

remove obsolete scorer methods, add @Override

Yonik Seeleyd46262e37311
diff --git a/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java b/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
index e4ea5e03079..efb341b1da8 100755
--- a/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
+++ b/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
@@ -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());