From d46262e37311004499c85bd6fb082e05c8a088da Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Fri, 24 Sep 2010 01:08:23 +0000 Subject: [PATCH] remove obsolete scorer methods, add @Override git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1000683 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/search/SolrConstantScoreQuery.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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 o 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());