You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/01/21 04:50:27 UTC

svn commit: r1061615 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/src/java/org/apache/lucene/search/ lucene/src/test/org/apache/lucene/search/ solr/ solr/src/java/org/apache/solr/schema/ solr/src/java/org/apache/solr/search/ solr/src/java/org...

Author: rmuir
Date: Fri Jan 21 03:50:26 2011
New Revision: 1061615

URL: http://svn.apache.org/viewvc?rev=1061615&view=rev
Log:
LUCENE-2876: Deprecate Scorer.getSimilarity

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ConjunctionScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqExclScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqOptSumScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/Scorer.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/ValueSource.java

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Fri Jan 21 03:50:26 2011
@@ -292,6 +292,11 @@ API Changes
 * LUCENE-2691: Deprecate IndexWriter.getReader in favor of
   IndexReader.open(IndexWriter) (Grant Ingersoll, Mike McCandless)
 
+* LUCENE-2876: Deprecated Scorer.getSimilarity(). If your Scorer uses a Similarity,
+  it should keep it itself. Fixed Scorers to pass their parent Weight, so that
+  Scorer.visitSubScorers (LUCENE-2590) will work correctly.
+  (Robert Muir, Doron Cohen)
+  
 Bug fixes
 
 * LUCENE-2249: ParallelMultiSearcher should shut down thread pool on

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer.java Fri Jan 21 03:50:26 2011
@@ -118,7 +118,7 @@ final class BooleanScorer extends Scorer
     int doc = NO_MORE_DOCS;
     int freq;
     
-    public BucketScorer() { super(null); }
+    public BucketScorer(Weight weight) { super(weight); }
     
     @Override
     public int advance(int target) throws IOException { return NO_MORE_DOCS; }
@@ -199,7 +199,7 @@ final class BooleanScorer extends Scorer
   
   BooleanScorer(Weight weight, boolean disableCoord, Similarity similarity, int minNrShouldMatch,
       List<Scorer> optionalScorers, List<Scorer> prohibitedScorers, int maxCoord) throws IOException {
-    super(null, weight);   // Similarity not used
+    super(weight);
     this.minNrShouldMatch = minNrShouldMatch;
 
     if (optionalScorers != null && optionalScorers.size() > 0) {
@@ -232,7 +232,7 @@ final class BooleanScorer extends Scorer
   protected boolean score(Collector collector, int max, int firstDocID) throws IOException {
     boolean more;
     Bucket tmp;
-    BucketScorer bs = new BucketScorer();
+    BucketScorer bs = new BucketScorer(weight);
     // The internal loop will set the score and doc before calling collect.
     collector.setScorer(bs);
     do {

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/BooleanScorer2.java Fri Jan 21 03:50:26 2011
@@ -67,8 +67,11 @@ class BooleanScorer2 extends Scorer {
    * prohibited and optional scorers. In no required scorers are added, at least
    * one of the optional scorers will have to match during the search.
    * 
-   * @param similarity
-   *          The similarity to be used.
+   * @param weight
+   *          The BooleanWeight to be used.
+   * @param disableCoord
+   *          If this parameter is true, coordination level matching 
+   *          ({@link Similarity#coord(int, int)}) is not used.
    * @param minNrShouldMatch
    *          The minimum number of optional added scorers that should match
    *          during the search. In case no required scorers are added, at least
@@ -82,7 +85,7 @@ class BooleanScorer2 extends Scorer {
    */
   public BooleanScorer2(Weight weight, boolean disableCoord, Similarity similarity, int minNrShouldMatch,
       List<Scorer> required, List<Scorer> prohibited, List<Scorer> optional, int maxCoord) throws IOException {
-    super(null, weight);   // Similarity not used
+    super(weight);
     if (minNrShouldMatch < 0) {
       throw new IllegalArgumentException("Minimum number of optional scorers should not be negative");
     }
@@ -107,7 +110,7 @@ class BooleanScorer2 extends Scorer {
     private float lastDocScore = Float.NaN;
 
     SingleMatchScorer(Scorer scorer) {
-      super(null); // No similarity used.
+      super(scorer.weight);
       this.scorer = scorer;
     }
 
@@ -143,7 +146,7 @@ class BooleanScorer2 extends Scorer {
   private Scorer countingDisjunctionSumScorer(final List<Scorer> scorers,
       int minNrShouldMatch) throws IOException {
     // each scorer from the list counted as a single matcher
-    return new DisjunctionSumScorer(scorers, minNrShouldMatch) {
+    return new DisjunctionSumScorer(weight, scorers, minNrShouldMatch) {
       private int lastScoredDoc = -1;
       // Save the score of lastScoredDoc, so that we don't compute it more than
       // once in score().
@@ -167,7 +170,7 @@ class BooleanScorer2 extends Scorer {
                                               List<Scorer> requiredScorers) throws IOException {
     // each scorer from the list counted as a single matcher
     final int requiredNrMatchers = requiredScorers.size();
-    return new ConjunctionScorer(disableCoord ? 1.0f : similarity.coord(requiredScorers.size(), requiredScorers.size()), requiredScorers) {
+    return new ConjunctionScorer(weight, disableCoord ? 1.0f : similarity.coord(requiredScorers.size(), requiredScorers.size()), requiredScorers) {
       private int lastScoredDoc = -1;
       // Save the score of lastScoredDoc, so that we don't compute it more than
       // once in score().
@@ -193,7 +196,7 @@ class BooleanScorer2 extends Scorer {
   private Scorer dualConjunctionSumScorer(boolean disableCoord,
                                           Similarity similarity,
                                           Scorer req1, Scorer req2) throws IOException { // non counting.
-    return new ConjunctionScorer(disableCoord ? 1.0f : similarity.coord(2, 2), new Scorer[]{req1, req2});
+    return new ConjunctionScorer(weight, disableCoord ? 1.0f : similarity.coord(2, 2), new Scorer[]{req1, req2});
     // All scorers match, so defaultSimilarity always has 1 as
     // the coordination factor.
     // Therefore the sum of the scores of two scorers
@@ -265,7 +268,7 @@ class BooleanScorer2 extends Scorer {
           : new ReqExclScorer(requiredCountingSumScorer,
                               ((prohibitedScorers.size() == 1)
                                 ? prohibitedScorers.get(0)
-                                : new DisjunctionSumScorer(prohibitedScorers)));
+                                : new DisjunctionSumScorer(weight, prohibitedScorers)));
   }
 
   /** Scores and collects all matching documents.

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ConjunctionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ConjunctionScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ConjunctionScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ConjunctionScorer.java Fri Jan 21 03:50:26 2011
@@ -29,12 +29,12 @@ class ConjunctionScorer extends Scorer {
   private final float coord;
   private int lastDoc = -1;
 
-  public ConjunctionScorer(float coord, Collection<Scorer> scorers) throws IOException {
-    this(coord, scorers.toArray(new Scorer[scorers.size()]));
+  public ConjunctionScorer(Weight weight, float coord, Collection<Scorer> scorers) throws IOException {
+    this(weight, coord, scorers.toArray(new Scorer[scorers.size()]));
   }
 
-  public ConjunctionScorer(float coord, Scorer... scorers) throws IOException {
-    super(null);
+  public ConjunctionScorer(Weight weight, float coord, Scorer... scorers) throws IOException {
+    super(weight);
     this.scorers = scorers;
     this.coord = coord;
     

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java Fri Jan 21 03:50:26 2011
@@ -100,7 +100,7 @@ public class DisjunctionMaxQuery extends
     /** The Weights for our subqueries, in 1-1 correspondence with disjuncts */
     protected ArrayList<Weight> weights = new ArrayList<Weight>();  // The Weight's for our subqueries, in 1-1 correspondence with disjuncts
 
-    /* Construct the Weight for this Query searched by searcher.  Recursively construct subquery weights. */
+    /** Construct the Weight for this Query searched by searcher.  Recursively construct subquery weights. */
     public DisjunctionMaxWeight(Searcher searcher) throws IOException {
       this.similarity = searcher.getSimilarity();
       for (Query disjunctQuery : disjuncts) {
@@ -108,15 +108,15 @@ public class DisjunctionMaxQuery extends
       }
     }
 
-    /* Return our associated DisjunctionMaxQuery */
+    /** Return our associated DisjunctionMaxQuery */
     @Override
     public Query getQuery() { return DisjunctionMaxQuery.this; }
 
-    /* Return our boost */
+    /** Return our boost */
     @Override
     public float getValue() { return getBoost(); }
 
-    /* Compute the sub of squared weights of us applied to our subqueries.  Used for normalization. */
+    /** Compute the sub of squared weights of us applied to our subqueries.  Used for normalization. */
     @Override
     public float sumOfSquaredWeights() throws IOException {
       float max = 0.0f, sum = 0.0f;
@@ -130,7 +130,7 @@ public class DisjunctionMaxQuery extends
       return (((sum - max) * tieBreakerMultiplier * tieBreakerMultiplier) + max) * boost * boost;
     }
 
-    /* Apply the computed normalization factor to our subqueries */
+    /** Apply the computed normalization factor to our subqueries */
     @Override
     public void normalize(float norm) {
       norm *= getBoost();  // Incorporate our boost
@@ -139,7 +139,7 @@ public class DisjunctionMaxQuery extends
       }
     }
 
-    /* Create the scorer used to score our associated DisjunctionMaxQuery */
+    /** Create the scorer used to score our associated DisjunctionMaxQuery */
     @Override
     public Scorer scorer(IndexReader reader, boolean scoreDocsInOrder,
         boolean topScorer) throws IOException {
@@ -152,11 +152,11 @@ public class DisjunctionMaxQuery extends
         }
       }
       if (idx == 0) return null; // all scorers did not have documents
-      DisjunctionMaxScorer result = new DisjunctionMaxScorer(tieBreakerMultiplier, similarity, scorers, idx);
+      DisjunctionMaxScorer result = new DisjunctionMaxScorer(this, tieBreakerMultiplier, similarity, scorers, idx);
       return result;
     }
 
-    /* Explain the score we computed for doc */
+    /** Explain the score we computed for doc */
     @Override
     public Explanation explain(IndexReader reader, int doc) throws IOException {
       if (disjuncts.size() == 1) return weights.get(0).explain(reader,doc);
@@ -178,7 +178,7 @@ public class DisjunctionMaxQuery extends
     
   }  // end of DisjunctionMaxWeight inner class
 
-  /* Create the Weight used to score us */
+  /** Create the Weight used to score us */
   @Override
   public Weight createWeight(Searcher searcher) throws IOException {
     return new DisjunctionMaxWeight(searcher);

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java Fri Jan 21 03:50:26 2011
@@ -40,6 +40,8 @@ class DisjunctionMaxScorer extends Score
   /**
    * Creates a new instance of DisjunctionMaxScorer
    * 
+   * @param weight
+   *          The Weight to be used.
    * @param tieBreakerMultiplier
    *          Multiplier applied to non-maximum-scoring subqueries for a
    *          document as they are summed into the result.
@@ -52,10 +54,9 @@ class DisjunctionMaxScorer extends Score
    *          The actual number of scorers to iterate on. Note that the array's
    *          length may be larger than the actual number of scorers.
    */
-  public DisjunctionMaxScorer(float tieBreakerMultiplier,
+  public DisjunctionMaxScorer(Weight weight, float tieBreakerMultiplier,
       Similarity similarity, Scorer[] subScorers, int numScorers) throws IOException {
-    super(similarity);
-
+    super(similarity, weight);
     this.tieBreakerMultiplier = tieBreakerMultiplier;
     // The passed subScorers array includes only scorers which have documents
     // (DisjunctionMaxQuery takes care of that), and their nextDoc() was already

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/DisjunctionSumScorer.java Fri Jan 21 03:50:26 2011
@@ -58,6 +58,7 @@ class DisjunctionSumScorer extends Score
   private float currentScore = Float.NaN;
   
   /** Construct a <code>DisjunctionScorer</code>.
+   * @param weight The weight to be used.
    * @param subScorers A collection of at least two subscorers.
    * @param minimumNrMatchers The positive minimum number of subscorers that should
    * match to match this query.
@@ -67,8 +68,8 @@ class DisjunctionSumScorer extends Score
    * <br>When minimumNrMatchers equals the number of subScorers,
    * it more efficient to use <code>ConjunctionScorer</code>.
    */
-  public DisjunctionSumScorer( List<Scorer> subScorers, int minimumNrMatchers) throws IOException {
-    super(null);
+  public DisjunctionSumScorer(Weight weight, List<Scorer> subScorers, int minimumNrMatchers) throws IOException {
+    super(weight);
     
     nrScorers = subScorers.size();
 
@@ -88,8 +89,8 @@ class DisjunctionSumScorer extends Score
   /** Construct a <code>DisjunctionScorer</code>, using one as the minimum number
    * of matching subscorers.
    */
-  public DisjunctionSumScorer(List<Scorer> subScorers) throws IOException {
-    this(subScorers, 1);
+  public DisjunctionSumScorer(Weight weight, List<Scorer> subScorers) throws IOException {
+    this(weight, subScorers, 1);
   }
 
   /** Called the first time next() or skipTo() is called to

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqExclScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqExclScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqExclScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqExclScorer.java Fri Jan 21 03:50:26 2011
@@ -36,7 +36,7 @@ class ReqExclScorer extends Scorer {
    * @param exclDisi indicates exclusion.
    */
   public ReqExclScorer(Scorer reqScorer, DocIdSetIterator exclDisi) {
-    super(null); // No similarity used.
+    super(reqScorer.weight);
     this.reqScorer = reqScorer;
     this.exclDisi = exclDisi;
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqOptSumScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqOptSumScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqOptSumScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ReqOptSumScorer.java Fri Jan 21 03:50:26 2011
@@ -38,7 +38,7 @@ class ReqOptSumScorer extends Scorer {
       Scorer reqScorer,
       Scorer optScorer)
   {
-    super(null); // No similarity used.
+    super(reqScorer.weight);
     this.reqScorer = reqScorer;
     this.optScorer = optScorer;
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/ScoreCachingWrappingScorer.java Fri Jan 21 03:50:26 2011
@@ -38,7 +38,7 @@ public class ScoreCachingWrappingScorer 
   
   /** Creates a new instance by wrapping the given scorer. */
   public ScoreCachingWrappingScorer(Scorer scorer) {
-    super(scorer.getSimilarity());
+    super(scorer.getSimilarity(), scorer.weight);
     this.scorer = scorer;
   }
 

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/Scorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/Scorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/Scorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/Scorer.java Fri Jan 21 03:50:26 2011
@@ -43,9 +43,19 @@ public abstract class Scorer extends Doc
   private final Similarity similarity;
   protected final Weight weight;
 
+  /**
+   * Constructs a Scorer
+   * @param weight The scorers <code>Weight</code>.
+   */
+  protected Scorer(Weight weight) {
+    this(null, weight);
+  }
+  
   /** Constructs a Scorer.
    * @param similarity The <code>Similarity</code> implementation used by this scorer.
+   * @deprecated Use {@link #Scorer(Weight)} instead.
    */
+  @Deprecated
   protected Scorer(Similarity similarity) {
     this(similarity, null);
   }
@@ -54,13 +64,18 @@ public abstract class Scorer extends Doc
    * Constructs a Scorer
    * @param similarity The <code>Similarity</code> implementation used by this scorer.
    * @param weight The scorers <code>Weight</code>
+   * @deprecated Use {@link #Scorer(Weight)} instead.
    */
+  @Deprecated
   protected Scorer(Similarity similarity, Weight weight) {
     this.similarity = similarity;
     this.weight = weight;
   }
 
-  /** Returns the Similarity implementation used by this scorer. */
+  /** Returns the Similarity implementation used by this scorer. 
+   * @deprecated Store any Similarity you might need privately in your implementation instead.
+   */
+  @Deprecated
   public Similarity getSimilarity() {
     return this.similarity;
   }
@@ -178,7 +193,7 @@ public abstract class Scorer extends Doc
    * <p>
    * Note: this method will throw {@link UnsupportedOperationException} if no
    * associated {@link Weight} instance is provided to
-   * {@link #Scorer(Similarity, Weight)}
+   * {@link #Scorer(Weight)}
    * </p>
    * 
    * @lucene.experimental

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/JustCompileSearch.java Fri Jan 21 03:50:26 2011
@@ -341,8 +341,8 @@ final class JustCompileSearch {
   
   static final class JustCompileScorer extends Scorer {
 
-    protected JustCompileScorer(Similarity similarity) {
-      super(similarity);
+    protected JustCompileScorer(Weight weight) {
+      super(weight);
     }
 
     @Override

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java Fri Jan 21 03:50:26 2011
@@ -19,6 +19,10 @@ package org.apache.lucene.search;
 
 import java.io.IOException;
 
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 
 public class TestPositiveScoresOnlyCollector extends LuceneTestCase {
@@ -26,8 +30,8 @@ public class TestPositiveScoresOnlyColle
   private static final class SimpleScorer extends Scorer {
     private int idx = -1;
     
-    public SimpleScorer() {
-      super(null);
+    public SimpleScorer(Weight weight) {
+      super(weight);
     }
     
     @Override public float score() throws IOException {
@@ -65,7 +69,14 @@ public class TestPositiveScoresOnlyColle
       }
     }
     
-    Scorer s = new SimpleScorer();
+    Directory directory = newDirectory();
+    RandomIndexWriter writer = new RandomIndexWriter(random, directory);
+    writer.commit();
+    IndexReader ir = writer.getReader();
+    writer.close();
+    IndexSearcher searcher = new IndexSearcher(ir);
+    Weight fake = new TermQuery(new Term("fake", "weight")).createWeight(searcher);
+    Scorer s = new SimpleScorer(fake);
     TopDocsCollector<ScoreDoc> tdc = TopScoreDocCollector.create(scores.length, true);
     Collector c = new PositiveScoresOnlyCollector(tdc);
     c.setScorer(s);
@@ -78,6 +89,9 @@ public class TestPositiveScoresOnlyColle
     for (int i = 0; i < sd.length; i++) {
       assertTrue("only positive scores should return: " + sd[i].score, sd[i].score > 0);
     }
+    searcher.close();
+    ir.close();
+    directory.close();
   }
   
 }

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java Fri Jan 21 03:50:26 2011
@@ -29,7 +29,7 @@ public class TestScoreCachingWrappingSco
     private int doc = -1;
     
     public SimpleScorer() {
-      super(null);
+      super((Similarity)null);
     }
     
     @Override public float score() throws IOException {

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java Fri Jan 21 03:50:26 2011
@@ -416,7 +416,7 @@ class SpatialDistanceQuery extends Query
     double lastDist;
 
     public SpatialScorer(Similarity similarity, IndexReader reader, SpatialWeight w) throws IOException {
-      super(similarity);
+      super(similarity, w);
       this.weight = w;
       this.qWeight = w.getValue();
       this.reader = reader;

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SolrConstantScoreQuery.java Fri Jan 21 03:50:26 2011
@@ -118,7 +118,7 @@ public class SolrConstantScoreQuery exte
     int doc = -1;
 
     public ConstantScorer(Similarity similarity, IndexReader reader, ConstantWeight w) throws IOException {
-      super(similarity);
+      super(similarity, w);
       theScore = w.getValue();
       DocIdSet docIdSet = filter instanceof SolrFilter ? ((SolrFilter)filter).getDocIdSet(w.context, reader) : filter.getDocIdSet(reader);
       if (docIdSet == null) {

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/BoostedQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/BoostedQuery.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/BoostedQuery.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/BoostedQuery.java Fri Jan 21 03:50:26 2011
@@ -133,7 +133,7 @@ public class BoostedQuery extends Query 
 
     private CustomScorer(Similarity similarity, Searcher searcher, IndexReader reader, BoostedQuery.BoostedWeight w,
         Scorer scorer, ValueSource vs) throws IOException {
-      super(similarity);
+      super(similarity, w);
       this.weight = w;
       this.qWeight = w.getValue();
       this.scorer = scorer;

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/FunctionQuery.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/FunctionQuery.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/FunctionQuery.java Fri Jan 21 03:50:26 2011
@@ -113,7 +113,7 @@ public class FunctionQuery extends Query
     final boolean hasDeletions;
 
     public AllScorer(Similarity similarity, IndexReader reader, FunctionWeight w) throws IOException {
-      super(similarity);
+      super(similarity, w);
       this.weight = w;
       this.qWeight = w.getValue();
       this.reader = reader;

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/ValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/ValueSource.java?rev=1061615&r1=1061614&r2=1061615&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/ValueSource.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/function/ValueSource.java Fri Jan 21 03:50:26 2011
@@ -197,7 +197,7 @@ class ValueSourceScorer extends Scorer {
   protected boolean checkDeletes;
 
   protected ValueSourceScorer(IndexReader reader, DocValues values) {
-    super(null);
+    super(null, null);
     this.reader = reader;
     this.maxDoc = reader.maxDoc();
     this.values = values;