You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2010/09/24 03:17:28 UTC
svn commit: r1000685 -
/lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
Author: yonik
Date: Fri Sep 24 01:17:28 2010
New Revision: 1000685
URL: http://svn.apache.org/viewvc?rev=1000685&view=rev
Log:
remove obsolete scorer methods, add @Override
Modified:
lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java?rev=1000685&r1=1000684&r2=1000685&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/FunctionQuery.java Fri Sep 24 01:17:28 2010
@@ -51,10 +51,12 @@ public class FunctionQuery extends Query
return func;
}
+ @Override
public Query rewrite(IndexReader reader) throws IOException {
return this;
}
+ @Override
public void extractTerms(Set terms) {}
protected class FunctionWeight extends Weight {
@@ -69,10 +71,12 @@ public class FunctionQuery extends Query
func.createWeight(context, searcher);
}
+ @Override
public Query getQuery() {
return FunctionQuery.this;
}
+ @Override
public float getValue() {
return queryWeight;
}
@@ -132,11 +136,11 @@ public class FunctionQuery extends Query
return doc;
}
- @Override
// instead of matching all docs, we could also embed a query.
// 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)
+ @Override
public int nextDoc() throws IOException {
for(;;) {
++doc;
@@ -155,29 +159,7 @@ public class FunctionQuery extends Query
return nextDoc();
}
- // instead of matching all docs, we could also embed a query.
- // 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;
- }
-
+ @Override
public float score() throws IOException {
float score = qWeight * vals.floatVal(doc);
@@ -187,11 +169,6 @@ public class FunctionQuery extends Query
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 {
float sc = qWeight * vals.floatVal(doc);
@@ -206,12 +183,14 @@ public class FunctionQuery extends Query
}
+ @Override
public Weight createWeight(Searcher searcher) throws IOException {
return new FunctionQuery.FunctionWeight(searcher);
}
/** Prints a user-readable version of this query. */
+ @Override
public String toString(String field)
{
float boost = getBoost();
@@ -221,6 +200,7 @@ public class FunctionQuery extends Query
/** Returns true if <code>o</code> is equal to this. */
+ @Override
public boolean equals(Object o) {
if (FunctionQuery.class != o.getClass()) return false;
FunctionQuery other = (FunctionQuery)o;
@@ -229,6 +209,7 @@ public class FunctionQuery extends Query
}
/** Returns a hash code value for this object. */
+ @Override
public int hashCode() {
return func.hashCode()*31 + Float.floatToIntBits(getBoost());
}