lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r807180 - in /lucene/java/trunk: ./ src/java/org/apache/lucene/search/ src/java/org/apache/lucene/search/function/ src/java/org/apache/lucene/search/spans/ src/test/org/apache/lucene/search/
Date Mon, 24 Aug 2009 12:26:44 GMT
Author: markrmiller
Date: Mon Aug 24 12:26:43 2009
New Revision: 807180

URL: http://svn.apache.org/viewvc?rev=807180&view=rev
Log:
LUCENE-1837: Remove Searcher from Weight#explain - partial revert of LUCENE-1771

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/IndexSearcher.java
    lucene/java/trunk/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/TermQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/Weight.java
    lucene/java/trunk/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
    lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanWeight.java
    lucene/java/trunk/src/test/org/apache/lucene/search/JustCompileSearch.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Mon Aug 24 12:26:43 2009
@@ -340,8 +340,8 @@
     BooleanQuery's setAllowDocsOutOfOrder and getAllowDocsOutOfOrder have been 
     deprecated as they are not needed anymore. BooleanQuery will now score docs 
     out of order when used with a Collector that can accept docs out of order.
-    Finally, Weight#explain now also takes a the top-level searcher, sub-reader 
-    and sub-docID.
+    Finally, Weight#explain now takes a sub-reader and sub-docID, rather than
+    a top level reader and docID.
     (Shai Erera, Chris Hostetter, Martin Ruckli, Mark Miller via Mike McCandless)
  	
 25. LUCENE-1466: Changed Tokenizer.input to be a CharStream; added

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java Mon Aug 24 12:26:43
2009
@@ -224,7 +224,7 @@
       }
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
+    public Explanation explain(IndexReader reader, int doc)
       throws IOException {
       final int minShouldMatch =
         BooleanQuery.this.getMinimumNumberShouldMatch();
@@ -241,7 +241,7 @@
         if (w.scorer(reader, true, true) == null) {
           continue;
         }
-        Explanation e = w.explain(searcher, reader, doc);
+        Explanation e = w.explain(reader, doc);
         if (!c.isProhibited()) maxCoord++;
         if (e.isMatch()) {
           if (!c.isProhibited()) {

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/ConstantScoreQuery.java Mon Aug 24
12:26:43 2009
@@ -81,7 +81,7 @@
       return new ConstantScorer(similarity, reader, this);
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException
{
+    public Explanation explain(IndexReader reader, int doc) throws IOException {
       
       ConstantScorer cs = new ConstantScorer(similarity, reader, this);
       boolean exists = cs.docIdSetIterator.advance(doc) == doc;

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java Mon Aug 24
12:26:43 2009
@@ -152,13 +152,13 @@
     }
 
     /* Explain the score we computed for doc */
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException
{
-      if (disjuncts.size() == 1) return ((Weight) weights.get(0)).explain(searcher, reader,doc);
+    public Explanation explain(IndexReader reader, int doc) throws IOException {
+      if (disjuncts.size() == 1) return ((Weight) weights.get(0)).explain(reader,doc);
       ComplexExplanation result = new ComplexExplanation();
       float max = 0.0f, sum = 0.0f;
       result.setDescription(tieBreakerMultiplier == 0.0f ? "max of:" : "max plus " + tieBreakerMultiplier
+ " times others of:");
       for (Iterator iter = weights.iterator(); iter.hasNext();) {
-        Explanation e = ((Weight) iter.next()).explain(searcher, reader, doc);
+        Explanation e = ((Weight) iter.next()).explain(reader, doc);
         if (e.isMatch()) {
           result.setMatch(Boolean.TRUE);
           result.addDetail(e);

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FilteredQuery.java Mon Aug 24 12:26:43
2009
@@ -73,8 +73,8 @@
         weight.normalize(v);
         value = weight.getValue() * getBoost();
       }
-      public Explanation explain (Searcher searcher, IndexReader ir, int i) throws IOException
{
-        Explanation inner = weight.explain (searcher, ir, i);
+      public Explanation explain (IndexReader ir, int i) throws IOException {
+        Explanation inner = weight.explain (ir, i);
         if (getBoost()!=1) {
           Explanation preBoost = inner;
           inner = new Explanation(inner.getValue()*getBoost(),"product of:");

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/IndexSearcher.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/IndexSearcher.java Mon Aug 24 12:26:43
2009
@@ -313,7 +313,7 @@
     int n = ReaderUtil.subIndex(doc, docStarts);
     int deBasedDoc = doc - docStarts[n];
     
-    return weight.explain(this, subReaders[n], deBasedDoc);
+    return weight.explain(subReaders[n], deBasedDoc);
   }
 
   private boolean fieldSortDoTrackScores;

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/MatchAllDocsQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/MatchAllDocsQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/MatchAllDocsQuery.java Mon Aug 24
12:26:43 2009
@@ -129,7 +129,7 @@
           normsField != null ? reader.norms(normsField) : null);
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) {
+    public Explanation explain(IndexReader reader, int doc) {
       // explain query weight
       Explanation queryExpl = new ComplexExplanation
         (true, getValue(), "MatchAllDocsQuery, product of:");

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/MultiPhraseQuery.java Mon Aug 24 12:26:43
2009
@@ -186,7 +186,7 @@
                                       slop, reader.norms(field));
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
+    public Explanation explain(IndexReader reader, int doc)
       throws IOException {
       ComplexExplanation result = new ComplexExplanation();
       result.setDescription("weight("+getQuery()+" in "+doc+"), product of:");

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/PhraseQuery.java Mon Aug 24 12:26:43
2009
@@ -158,7 +158,7 @@
 
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
+    public Explanation explain(IndexReader reader, int doc)
       throws IOException {
 
       Explanation result = new Explanation();

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/TermQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/TermQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/TermQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/TermQuery.java Mon Aug 24 12:26:43
2009
@@ -69,19 +69,14 @@
       return new TermScorer(this, termDocs, similarity, reader.norms(term.field()));
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc)
+    public Explanation explain(IndexReader reader, int doc)
       throws IOException {
 
       ComplexExplanation result = new ComplexExplanation();
       result.setDescription("weight("+getQuery()+" in "+doc+"), product of:");
 
-      Explanation expl;
-      if(searcher == null) {
-        expl = new Explanation(idf, "idf(" + idf + ")");
-      } else {
-        expl = new Explanation(idf, "idf(docFreq=" + searcher.docFreq(term) +
-            ", maxDocs=" + searcher.maxDoc() + ")");
-      }
+      Explanation expl = new Explanation(idf, "idf(docFreq=" + reader.docFreq(term) +
+            ", maxDocs=" + reader.maxDoc() + ")");
 
       // explain query weight
       Explanation queryExpl = new Explanation();

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/Weight.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/Weight.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/Weight.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/Weight.java Mon Aug 24 12:26:43 2009
@@ -61,7 +61,7 @@
    * @return an Explanation for the score
    * @throws IOException
    */
-  public abstract Explanation explain(Searcher searcher, IndexReader reader, int doc) throws
IOException;
+  public abstract Explanation explain(IndexReader reader, int doc) throws IOException;
 
   /** The query that this concerns. */
   public abstract Query getQuery();

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/function/CustomScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/function/CustomScoreQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/function/CustomScoreQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/function/CustomScoreQuery.java Mon
Aug 24 12:26:43 2009
@@ -341,17 +341,17 @@
       return new CustomScorer(similarity, reader, this, subQueryScorer, valSrcScorers);
     }
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException
{
-      Explanation explain = doExplain(searcher, reader, doc);
-      return explain == null ? new Explanation(0.0f, "no matching docs") : doExplain(searcher,
reader, doc);
+    public Explanation explain(IndexReader reader, int doc) throws IOException {
+      Explanation explain = doExplain(reader, doc);
+      return explain == null ? new Explanation(0.0f, "no matching docs") : doExplain(reader,
doc);
     }
     
-    private Explanation doExplain(Searcher searcher, IndexReader reader, int doc) throws
IOException {
+    private Explanation doExplain(IndexReader reader, int doc) throws IOException {
       Scorer[] valSrcScorers = new Scorer[valSrcWeights.length];
       for(int i = 0; i < valSrcScorers.length; i++) {
          valSrcScorers[i] = valSrcWeights[i].scorer(reader, true, false);
       }
-      Explanation subQueryExpl = subQueryWeight.explain(searcher, reader, doc);
+      Explanation subQueryExpl = subQueryWeight.explain(reader, doc);
       if (!subQueryExpl.isMatch()) {
         return subQueryExpl;
       }
@@ -451,7 +451,7 @@
     // TODO: remove in 3.0
     /*(non-Javadoc) @see org.apache.lucene.search.Scorer#explain(int) */
     public Explanation explain(int doc) throws IOException {
-      Explanation subQueryExpl = weight.subQueryWeight.explain(null, reader,doc); // nocommit:
needs resolution
+      Explanation subQueryExpl = weight.subQueryWeight.explain(reader,doc);
       if (!subQueryExpl.isMatch()) {
         return subQueryExpl;
       }

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/function/ValueSourceQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/function/ValueSourceQuery.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/function/ValueSourceQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/function/ValueSourceQuery.java Mon
Aug 24 12:26:43 2009
@@ -98,7 +98,7 @@
     }
 
     /*(non-Javadoc) @see org.apache.lucene.search.Weight#explain(org.apache.lucene.index.IndexReader,
int) */
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException
{
+    public Explanation explain(IndexReader reader, int doc) throws IOException {
       return new ValueSourceScorer(similarity, reader, this).explain(doc);
     }
   }

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanWeight.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanWeight.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanWeight.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanWeight.java Mon Aug 24 12:26:43
2009
@@ -68,7 +68,7 @@
         .norms(query.getField()));
   }
 
-  public Explanation explain(Searcher searcher, IndexReader reader, int doc)
+  public Explanation explain(IndexReader reader, int doc)
     throws IOException {
 
     ComplexExplanation result = new ComplexExplanation();

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=807180&r1=807179&r2=807180&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/JustCompileSearch.java Mon Aug 24
12:26:43 2009
@@ -425,7 +425,7 @@
 
   static final class JustCompileWeight extends Weight {
 
-    public Explanation explain(Searcher searcher, IndexReader reader, int doc) throws IOException
{
+    public Explanation explain(IndexReader reader, int doc) throws IOException {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
 



Mime
View raw message