lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1136042 - in /lucene/dev/branches/flexscoring: lucene/src/java/org/apache/lucene/search/ lucene/src/java/org/apache/lucene/search/function/ lucene/src/java/org/apache/lucene/search/spans/ lucene/src/test/org/apache/lucene/search/ solr/src/...
Date Wed, 15 Jun 2011 13:50:34 GMT
Author: rmuir
Date: Wed Jun 15 13:50:34 2011
New Revision: 1136042

URL: http://svn.apache.org/viewvc?rev=1136042&view=rev
Log:
LUCENE-2959: separate passing down of query norms from passing down of top-level (e.g. bq's)
boosts

Modified:
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/FilteredQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/PhraseQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Query.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/TermQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Weight.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
    lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/spans/SpanWeight.java
    lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
    lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/schema/LatLonType.java
    lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java
    lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
    lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
    lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/FunctionQuery.java

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/BooleanQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/BooleanQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/BooleanQuery.java
Wed Jun 15 13:50:34 2011
@@ -206,11 +206,11 @@ public class BooleanQuery extends Query 
     }
 
     @Override
-    public void normalize(float norm) {
-      norm *= getBoost();                         // incorporate boost
+    public void normalize(float norm, float topLevelBoost) {
+      topLevelBoost *= getBoost();                         // incorporate boost
       for (Weight w : weights) {
         // normalize all clauses, (even if prohibited in case of side affects)
-        w.normalize(norm);
+        w.normalize(norm, topLevelBoost);
       }
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/ConstantScoreQuery.java
Wed Jun 15 13:50:34 2011
@@ -123,11 +123,11 @@ public class ConstantScoreQuery extends 
     }
 
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
       // we normalize the inner weight, but ignore it (just to initialize everything)
-      if (innerWeight != null) innerWeight.normalize(norm);
+      if (innerWeight != null) innerWeight.normalize(norm, topLevelBoost);
     }
 
     @Override

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
Wed Jun 15 13:50:34 2011
@@ -130,10 +130,10 @@ public class DisjunctionMaxQuery extends
 
     /** Apply the computed normalization factor to our subqueries */
     @Override
-    public void normalize(float norm) {
-      norm *= getBoost();  // Incorporate our boost
+    public void normalize(float norm, float topLevelBoost) {
+      topLevelBoost *= getBoost();  // Incorporate our boost
       for (Weight wt : weights) {
-        wt.normalize(norm);
+        wt.normalize(norm, topLevelBoost);
       }
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/FilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/FilteredQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/FilteredQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/FilteredQuery.java
Wed Jun 15 13:50:34 2011
@@ -75,8 +75,8 @@ extends Query {
       }
 
       @Override
-      public void normalize (float v) { 
-        weight.normalize(v);
+      public void normalize (float norm, float topLevelBoost) { 
+        weight.normalize(norm, topLevelBoost);
         value = weight.getValue() * getBoost();
       }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MatchAllDocsQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
Wed Jun 15 13:50:34 2011
@@ -123,8 +123,8 @@ public class MatchAllDocsQuery extends Q
     }
 
     @Override
-    public void normalize(float queryNorm) {
-      this.queryNorm = queryNorm;
+    public void normalize(float queryNorm, float topLevelBoost) {
+      this.queryNorm = queryNorm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/MultiPhraseQuery.java
Wed Jun 15 13:50:34 2011
@@ -167,9 +167,9 @@ public class MultiPhraseQuery extends Qu
     }
 
     @Override
-    public void normalize(float queryNorm) {
-      this.queryNorm = queryNorm;
-      queryWeight *= queryNorm;                   // normalize query weight
+    public void normalize(float queryNorm, float topLevelBoost) {
+      this.queryNorm = queryNorm * topLevelBoost;
+      queryWeight *= this.queryNorm;              // normalize query weight
       value = queryWeight * idf;                  // idf for document 
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/PhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/PhraseQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/PhraseQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/PhraseQuery.java
Wed Jun 15 13:50:34 2011
@@ -208,9 +208,9 @@ public class PhraseQuery extends Query {
     }
 
     @Override
-    public void normalize(float queryNorm) {
-      this.queryNorm = queryNorm;
-      queryWeight *= queryNorm;                   // normalize query weight
+    public void normalize(float queryNorm, float topLevelBoost) {
+      this.queryNorm = queryNorm * topLevelBoost;
+      queryWeight *= this.queryNorm;              // normalize query weight
       value = queryWeight * idf;                  // idf for document 
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Query.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Query.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Query.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Query.java Wed
Jun 15 13:50:34 2011
@@ -101,7 +101,7 @@ public abstract class Query implements C
     float norm = searcher.getSimilarityProvider().queryNorm(sum);
     if (Float.isInfinite(norm) || Float.isNaN(norm))
       norm = 1.0f;
-    weight.normalize(norm);
+    weight.normalize(norm, 1.0f);
     return weight;
   }
   

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/TermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/TermQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/TermQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/TermQuery.java
Wed Jun 15 13:50:34 2011
@@ -75,9 +75,9 @@ public class TermQuery extends Query {
     }
 
     @Override
-    public void normalize(float queryNorm) {
-      this.queryNorm = queryNorm;
-      queryWeight *= queryNorm;                   // normalize query weight
+    public void normalize(float queryNorm, float topLevelBoost) {
+      this.queryNorm = queryNorm * topLevelBoost;
+      queryWeight *= this.queryNorm;              // normalize query weight
       value = queryWeight * idf;                  // idf for document
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Weight.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Weight.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Weight.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/Weight.java Wed
Jun 15 13:50:34 2011
@@ -72,7 +72,7 @@ public abstract class Weight {
   public abstract float getValue();
 
   /** Assigns the query normalization factor to this. */
-  public abstract void normalize(float norm);
+  public abstract void normalize(float norm, float topLevelBoost);
 
   /**
    * Returns a {@link Scorer} which scores documents in/out-of order according

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/CustomScoreQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
Wed Jun 15 13:50:34 2011
@@ -224,14 +224,14 @@ public class CustomScoreQuery extends Qu
 
     /*(non-Javadoc) @see org.apache.lucene.search.Weight#normalize(float) */
     @Override
-    public void normalize(float norm) {
-      norm *= getBoost(); // incorporate boost
-      subQueryWeight.normalize(norm);
+    public void normalize(float norm, float topLevelBoost) {
+      topLevelBoost *= getBoost(); // incorporate boost
+      subQueryWeight.normalize(norm, topLevelBoost);
       for(int i = 0; i < valSrcWeights.length; i++) {
         if (qStrict) {
-          valSrcWeights[i].normalize(1); // do not normalize the ValueSource part
+          valSrcWeights[i].normalize(1, 1); // do not normalize the ValueSource part
         } else {
-          valSrcWeights[i].normalize(norm);
+          valSrcWeights[i].normalize(norm, topLevelBoost);
         }
       }
     }

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/ValueSourceQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
Wed Jun 15 13:50:34 2011
@@ -91,8 +91,8 @@ public class ValueSourceQuery extends Qu
 
     /*(non-Javadoc) @see org.apache.lucene.search.Weight#normalize(float) */
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/spans/SpanWeight.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/spans/SpanWeight.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/spans/SpanWeight.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/java/org/apache/lucene/search/spans/SpanWeight.java
Wed Jun 15 13:50:34 2011
@@ -71,9 +71,9 @@ public class SpanWeight extends Weight {
   }
 
   @Override
-  public void normalize(float queryNorm) {
-    this.queryNorm = queryNorm;
-    queryWeight *= queryNorm;                     // normalize query weight
+  public void normalize(float queryNorm, float topLevelBoost) {
+    this.queryNorm = queryNorm * topLevelBoost;
+    queryWeight *= this.queryNorm;                // normalize query weight
     value = queryWeight * idf;                    // idf for document
   }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
(original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
Wed Jun 15 13:50:34 2011
@@ -354,7 +354,7 @@ final class JustCompileSearch {
     }
 
     @Override
-    public void normalize(float norm) {
+    public void normalize(float norm, float topLevelBoost) {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 

Modified: lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/schema/LatLonType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/schema/LatLonType.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/schema/LatLonType.java (original)
+++ lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/schema/LatLonType.java Wed
Jun 15 13:50:34 2011
@@ -365,8 +365,8 @@ class SpatialDistanceQuery extends Query
     }
 
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 

Modified: lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java
(original)
+++ lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/JoinQParserPlugin.java
Wed Jun 15 13:50:34 2011
@@ -180,8 +180,8 @@ class JoinQuery extends Query {
     }
 
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 

Modified: lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
(original)
+++ lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
Wed Jun 15 13:50:34 2011
@@ -85,8 +85,8 @@ public class SolrConstantScoreQuery exte
     }
 
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 

Modified: lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/BoostedQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
(original)
+++ lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
Wed Jun 15 13:50:34 2011
@@ -90,9 +90,9 @@ public class BoostedQuery extends Query 
     }
 
     @Override
-    public void normalize(float norm) {
-      norm *= getBoost();
-      qWeight.normalize(norm);
+    public void normalize(float norm, float topLevelBoost) {
+      topLevelBoost *= getBoost();
+      qWeight.normalize(norm, topLevelBoost);
     }
 
     @Override

Modified: lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/FunctionQuery.java?rev=1136042&r1=1136041&r2=1136042&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
(original)
+++ lucene/dev/branches/flexscoring/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
Wed Jun 15 13:50:34 2011
@@ -88,8 +88,8 @@ public class FunctionQuery extends Query
     }
 
     @Override
-    public void normalize(float norm) {
-      this.queryNorm = norm;
+    public void normalize(float norm, float topLevelBoost) {
+      this.queryNorm = norm * topLevelBoost;
       queryWeight *= this.queryNorm;
     }
 



Mime
View raw message