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 2012/09/17 20:52:40 UTC
svn commit: r1386770 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/CHANGES.txt lucene/core/
lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
Author: rmuir
Date: Mon Sep 17 18:52:40 2012
New Revision: 1386770
URL: http://svn.apache.org/viewvc?rev=1386770&view=rev
Log:
LUCENE-4401: don't call score() on NO_MORE_DOCS in DisjunctionSumScorer
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1386770&r1=1386769&r2=1386770&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Mon Sep 17 18:52:40 2012
@@ -157,6 +157,9 @@ Bug Fixes
* LUCENE-3720: fix memory-consumption issues with BeiderMorseFilter.
(Thomas Neidhart via Robert Muir)
+* LUCENE-4401: Fix bug where DisjunctionSumScorer would sometimes call score()
+ on a subscorer that had already returned NO_MORE_DOCS. (Liu Chao, Robert Muir)
+
Optimizations
* LUCENE-4322: Decrease lucene-core JAR size. The core JAR size had increased a
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java?rev=1386770&r1=1386769&r2=1386770&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java Mon Sep 17 18:52:40 2012
@@ -190,6 +190,7 @@ public class ConstantScoreQuery extends
@Override
public float score() throws IOException {
+ assert docIdSetIterator.docID() != NO_MORE_DOCS;
return theScore;
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java?rev=1386770&r1=1386769&r2=1386770&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/DisjunctionSumScorer.java Mon Sep 17 18:52:40 2012
@@ -68,6 +68,7 @@ class DisjunctionSumScorer extends Disju
@Override
public int nextDoc() throws IOException {
+ assert doc != NO_MORE_DOCS;
while(true) {
while (subScorers[0].docID() == doc) {
if (subScorers[0].nextDoc() != NO_MORE_DOCS) {
@@ -91,10 +92,14 @@ class DisjunctionSumScorer extends Disju
private void afterNext() throws IOException {
final Scorer sub = subScorers[0];
doc = sub.docID();
- score = sub.score();
- nrMatchers = 1;
- countMatches(1);
- countMatches(2);
+ if (doc == NO_MORE_DOCS) {
+ nrMatchers = Integer.MAX_VALUE; // stop looping
+ } else {
+ score = sub.score();
+ nrMatchers = 1;
+ countMatches(1);
+ countMatches(2);
+ }
}
// TODO: this currently scores, but so did the previous impl