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 2011/01/08 02:37:08 UTC

svn commit: r1056588 - /lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java

Author: yonik
Date: Sat Jan  8 01:37:07 2011
New Revision: 1056588

URL: http://svn.apache.org/viewvc?rev=1056588&view=rev
Log:
LUCENE-2831: attempt to use the correct reader context rather than doing getTopReaderContext on a leaf

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java?rev=1056588&r1=1056587&r2=1056588&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/function/BoostedQuery.java Sat Jan  8 01:37:07 2011
@@ -61,13 +61,13 @@ public class BoostedQuery extends Query 
   private class BoostedWeight extends Weight {
     IndexSearcher searcher;
     Weight qWeight;
-    Map context;
+    Map fcontext;
 
     public BoostedWeight(IndexSearcher searcher) throws IOException {
       this.searcher = searcher;
       this.qWeight = q.weight(searcher);
-      this.context = boostVal.newContext(searcher);
-      boostVal.createWeight(context,searcher);
+      this.fcontext = boostVal.newContext(searcher);
+      boostVal.createWeight(fcontext,searcher);
     }
 
     public Query getQuery() {
@@ -106,7 +106,7 @@ public class BoostedQuery extends Query 
       if (!subQueryExpl.isMatch()) {
         return subQueryExpl;
       }
-      DocValues vals = boostVal.getValues(context, readerContext.reader);
+      DocValues vals = boostVal.getValues(fcontext, readerContext.reader);
       float sc = subQueryExpl.getValue() * vals.floatVal(doc);
       Explanation res = new ComplexExplanation(
         true, sc, BoostedQuery.this.toString() + ", product of:");
@@ -133,7 +133,7 @@ public class BoostedQuery extends Query 
       this.scorer = scorer;
       this.reader = reader;
       this.searcher = searcher; // for explain
-      this.vals = vs.getValues(weight.context, reader);
+      this.vals = vs.getValues(weight.fcontext, reader);
     }
 
     @Override
@@ -162,7 +162,7 @@ public class BoostedQuery extends Query 
     }
 
     public Explanation explain(int doc) throws IOException {
-      Explanation subQueryExpl = weight.qWeight.explain(reader.getTopReaderContext() ,doc);
+      Explanation subQueryExpl = weight.qWeight.explain(ValueSource.readerToContext(weight.fcontext,reader) ,doc);
       if (!subQueryExpl.isMatch()) {
         return subQueryExpl;
       }