lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [22/50] [abbrv] lucene-solr:jira/solr-11779: LUCENE-8142: Fix AssertingImpactsEnum and add missing javadoc.
Date Tue, 08 May 2018 21:15:08 GMT
LUCENE-8142: Fix AssertingImpactsEnum and add missing javadoc.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/46ecb739
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/46ecb739
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/46ecb739

Branch: refs/heads/jira/solr-11779
Commit: 46ecb739766a1a82b458b417e35f9c0936288e65
Parents: e00c4ce
Author: Adrien Grand <jpountz@gmail.com>
Authored: Wed May 2 17:20:42 2018 +0200
Committer: Adrien Grand <jpountz@gmail.com>
Committed: Wed May 2 17:20:42 2018 +0200

----------------------------------------------------------------------
 lucene/core/src/java/org/apache/lucene/index/Impacts.java     | 3 +++
 .../java/org/apache/lucene/search/DisjunctionMaxScorer.java   | 1 +
 .../java/org/apache/lucene/search/DisjunctionSumScorer.java   | 1 +
 .../core/src/java/org/apache/lucene/search/ReqExclScorer.java | 5 +++++
 .../src/java/org/apache/lucene/search/ReqOptSumScorer.java    | 7 +++++++
 .../src/java/org/apache/lucene/search/AssertingScorer.java    | 2 +-
 6 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/core/src/java/org/apache/lucene/index/Impacts.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/Impacts.java b/lucene/core/src/java/org/apache/lucene/index/Impacts.java
index ce3ece4..f6542b9 100644
--- a/lucene/core/src/java/org/apache/lucene/index/Impacts.java
+++ b/lucene/core/src/java/org/apache/lucene/index/Impacts.java
@@ -23,6 +23,9 @@ import java.util.List;
  */
 public abstract class Impacts {
 
+  /** Sole constructor. Typically invoked by sub classes. */
+  protected Impacts() {}
+
   /**
    * Return the number of levels on which we have impacts.
    * The returned value is always greater than 0 and may not always be the

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
index 3b86068..6d2f65c 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
@@ -53,6 +53,7 @@ final class DisjunctionMaxScorer extends DisjunctionScorer {
     float scoreMax = 0;
     double otherScoreSum = 0;
     for (Scorer scorer : subScorers) {
+      scorer.advanceShallow(0);
       float subScore = scorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
       if (subScore >= scoreMax) {
         otherScoreSum += scoreMax;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
index fa92fcd..4f45b07 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
@@ -36,6 +36,7 @@ final class DisjunctionSumScorer extends DisjunctionScorer {
     super(weight, subScorers, needsScores);
     double maxScore = 0;
     for (Scorer scorer : subScorers) {
+      scorer.advanceShallow(0);
       maxScore += scorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
     }
     // The error of sums depends on the order in which values are summed up. In

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java b/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
index 987293e..cee0a45 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
@@ -77,6 +77,11 @@ class ReqExclScorer extends Scorer {
   }
 
   @Override
+  public int advanceShallow(int target) throws IOException {
+    return reqScorer.advanceShallow(target);
+  }
+
+  @Override
   public float getMaxScore(int upTo) throws IOException {
     return reqScorer.getMaxScore(upTo);
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java b/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
index 6d93a54..418ad99 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
@@ -52,6 +52,7 @@ class ReqOptSumScorer extends Scorer {
     this.reqScorer = reqScorer;
     this.optScorer = optScorer;
 
+    reqScorer.advanceShallow(0);
     this.reqMaxScore = reqScorer.getMaxScore(DocIdSetIterator.NO_MORE_DOCS);
     this.maxScorePropagator = new MaxScoreSumPropagator(Arrays.asList(reqScorer, optScorer));
 
@@ -210,6 +211,12 @@ class ReqOptSumScorer extends Scorer {
   }
 
   @Override
+  public int advanceShallow(int target) throws IOException {
+    optScorer.advanceShallow(target);
+    return reqScorer.advanceShallow(target);
+  }
+
+  @Override
   public float getMaxScore(int upTo) throws IOException {
     float maxScore = reqScorer.getMaxScore(upTo);
     if (optScorer.docID() <= upTo) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/46ecb739/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
b/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
index 00aee41..952687f 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
@@ -40,7 +40,7 @@ public class AssertingScorer extends Scorer {
   IteratorState state = IteratorState.ITERATING;
   int doc;
   float minCompetitiveScore = 0;
-  int lastShallowTarget;
+  int lastShallowTarget = -1;
 
   private AssertingScorer(Random random, Scorer in, ScoreMode scoreMode) {
     super(in.weight);


Mime
View raw message