You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2017/01/24 08:58:06 UTC
[01/10] lucene-solr:apiv2: Add 6.4.0 back compat test indexes
Repository: lucene-solr
Updated Branches:
refs/heads/apiv2 95edfb78d -> 8d05282be
Add 6.4.0 back compat test indexes
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/185716ec
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/185716ec
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/185716ec
Branch: refs/heads/apiv2
Commit: 185716ecacf0c56dd30fd08fa9a3fdcc4be133d3
Parents: ee5a360
Author: Jim Ferenczi <ji...@elastic.co>
Authored: Mon Jan 23 09:47:54 2017 +0100
Committer: Jim Ferenczi <ji...@elastic.co>
Committed: Mon Jan 23 09:47:54 2017 +0100
----------------------------------------------------------------------
.../lucene/index/TestBackwardsCompatibility.java | 4 +++-
.../org/apache/lucene/index/index.6.4.0-cfs.zip | Bin 0 -> 15829 bytes
.../org/apache/lucene/index/index.6.4.0-nocfs.zip | Bin 0 -> 15831 bytes
3 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/185716ec/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
index d924238..73b7271 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
@@ -291,7 +291,9 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
"6.2.1-cfs",
"6.2.1-nocfs",
"6.3.0-cfs",
- "6.3.0-nocfs"
+ "6.3.0-nocfs",
+ "6.4.0-cfs",
+ "6.4.0-nocfs"
};
final String[] unsupportedNames = {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/185716ec/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-cfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-cfs.zip
new file mode 100644
index 0000000..e5bad02
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-cfs.zip differ
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/185716ec/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-nocfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-nocfs.zip
new file mode 100644
index 0000000..70fc6ee
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.4.0-nocfs.zip differ
[03/10] lucene-solr:apiv2: LUCENE-7640: Fix test failure.
Posted by no...@apache.org.
LUCENE-7640: Fix test failure.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c7fdd109
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c7fdd109
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c7fdd109
Branch: refs/heads/apiv2
Commit: c7fdd10971410944b586e6166f4cf95036c7a148
Parents: 9571d0f
Author: Adrien Grand <jp...@gmail.com>
Authored: Mon Jan 23 10:08:19 2017 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Mon Jan 23 10:08:19 2017 +0100
----------------------------------------------------------------------
.../lucene60/TestLucene60PointsFormat.java | 37 +++++++++++---------
.../org/apache/lucene/util/bkd/TestBKD.java | 37 +++++++++++---------
2 files changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c7fdd109/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
index 08dc6c6..8f0be3a 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
@@ -253,25 +253,28 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
}));
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
- assertEquals((actualMaxPointsInLeafNode + 1) / 2,
- points.estimatePointCount(new IntersectVisitor() {
- @Override
- public void visit(int docID, byte[] packedValue) throws IOException {}
-
- @Override
- public void visit(int docID) throws IOException {}
-
- @Override
- public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
- for (int dim = 0; dim < 2; ++dim) {
- if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
- StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
- return Relation.CELL_OUTSIDE_QUERY;
- }
+ // in general, or maybe 2x that if the point is a split value
+ final long pointCount = points.estimatePointCount(new IntersectVisitor() {
+ @Override
+ public void visit(int docID, byte[] packedValue) throws IOException {}
+
+ @Override
+ public void visit(int docID) throws IOException {}
+
+ @Override
+ public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+ for (int dim = 0; dim < 2; ++dim) {
+ if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
+ StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
+ return Relation.CELL_OUTSIDE_QUERY;
}
- return Relation.CELL_CROSSES_QUERY;
}
- }));
+ return Relation.CELL_CROSSES_QUERY;
+ }
+ });
+ assertTrue(""+pointCount,
+ pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+ pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
r.close();
dir.close();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c7fdd109/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
index fecdaa5..b9dad6f 100644
--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
@@ -1173,23 +1173,26 @@ public class TestBKD extends LuceneTestCase {
}));
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
- assertEquals((actualMaxPointsInLeafNode + 1) / 2,
- points.estimatePointCount(new IntersectVisitor() {
- @Override
- public void visit(int docID, byte[] packedValue) throws IOException {}
-
- @Override
- public void visit(int docID) throws IOException {}
-
- @Override
- public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
- if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
- StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
- return Relation.CELL_OUTSIDE_QUERY;
- }
- return Relation.CELL_CROSSES_QUERY;
- }
- }));
+ // in general, or maybe 2x that if the point is a split value
+ final long pointCount = points.estimatePointCount(new IntersectVisitor() {
+ @Override
+ public void visit(int docID, byte[] packedValue) throws IOException {}
+
+ @Override
+ public void visit(int docID) throws IOException {}
+
+ @Override
+ public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
+ if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
+ StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
+ return Relation.CELL_OUTSIDE_QUERY;
+ }
+ return Relation.CELL_CROSSES_QUERY;
+ }
+ });
+ assertTrue(""+pointCount,
+ pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
+ pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
pointsIn.close();
dir.close();
[09/10] lucene-solr:apiv2: Merge branch 'master' into apiv2
Posted by no...@apache.org.
Merge branch 'master' into apiv2
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/89990150
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/89990150
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/89990150
Branch: refs/heads/apiv2
Commit: 89990150d3f7ad6cc5128ce5d797f42e26ef3163
Parents: 95edfb7 ca50e5b
Author: Noble Paul <no...@apache.org>
Authored: Tue Jan 24 18:39:07 2017 +1030
Committer: Noble Paul <no...@apache.org>
Committed: Tue Jan 24 18:39:07 2017 +1030
----------------------------------------------------------------------
dev-tools/doap/lucene.rdf | 7 +++-
dev-tools/doap/solr.rdf | 9 ++++-
lucene/CHANGES.txt | 2 +
.../index/TestBackwardsCompatibility.java | 4 +-
.../org/apache/lucene/index/index.6.4.0-cfs.zip | Bin 0 -> 15829 bytes
.../apache/lucene/index/index.6.4.0-nocfs.zip | Bin 0 -> 15831 bytes
lucene/common-build.xml | 1 +
.../SortedNumericDocValuesRangeQuery.java | 5 +--
.../lucene60/TestLucene60PointsFormat.java | 37 ++++++++++---------
.../org/apache/lucene/util/bkd/TestBKD.java | 37 ++++++++++---------
lucene/ivy-versions.properties | 2 +-
.../randomizedtesting-runner-2.4.0.jar.sha1 | 1 -
.../randomizedtesting-runner-2.5.0.jar.sha1 | 1 +
solr/CHANGES.txt | 2 +
.../component/MoreLikeThisComponent.java | 12 +++++-
.../handler/component/TermVectorComponent.java | 9 +++++
.../component/DistributedMLTComponentTest.java | 23 ++++++++++++
.../TermVectorComponentDistributedTest.java | 18 +++++++++
solr/licenses/junit4-ant-2.4.0.jar.sha1 | 1 -
solr/licenses/junit4-ant-2.5.0.jar.sha1 | 1 +
.../randomizedtesting-runner-2.4.0.jar.sha1 | 1 -
.../randomizedtesting-runner-2.5.0.jar.sha1 | 1 +
22 files changed, 128 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
[06/10] lucene-solr:apiv2: SOLR-9114: NPE using TermVectorComponent,
MoreLikeThisComponent in combination with ExactStatsCache
Posted by no...@apache.org.
SOLR-9114: NPE using TermVectorComponent, MoreLikeThisComponent in combination with ExactStatsCache
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d34f549d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d34f549d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d34f549d
Branch: refs/heads/apiv2
Commit: d34f549df6cee0db7cbff1ec2639262c2f7e21e2
Parents: 6693c26
Author: Cao Manh Dat <da...@apache.org>
Authored: Mon Jan 23 17:41:35 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Mon Jan 23 17:41:35 2017 +0700
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
.../component/MoreLikeThisComponent.java | 12 +++++++++-
.../handler/component/TermVectorComponent.java | 9 ++++++++
.../component/DistributedMLTComponentTest.java | 23 ++++++++++++++++++++
.../TermVectorComponentDistributedTest.java | 18 +++++++++++++++
5 files changed, 63 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d34f549d/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index abd2983..a68f445 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -121,6 +121,8 @@ Bug Fixes
* SOLR-9979: Macro expansion should not be done in shard requests (Tom�s Fern�ndez L�bbe)
+* SOLR-9114: NPE using TermVectorComponent, MoreLikeThisComponent in combination with ExactStatsCache (Cao Manh Dat, Varun Thacker)
+
Optimizations
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d34f549d/solr/core/src/java/org/apache/solr/handler/component/MoreLikeThisComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/MoreLikeThisComponent.java b/solr/core/src/java/org/apache/solr/handler/component/MoreLikeThisComponent.java
index 893cdf3..55edc63 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/MoreLikeThisComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/MoreLikeThisComponent.java
@@ -221,7 +221,17 @@ public class MoreLikeThisComponent extends SearchComponent {
}
super.finishStage(rb);
}
-
+
+ @Override
+ public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
+ SolrParams params = rb.req.getParams();
+ if (!params.getBool(COMPONENT_NAME, false)) return;
+ if ((sreq.purpose & ShardRequest.PURPOSE_GET_MLT_RESULTS) == 0
+ && (sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) == 0) {
+ sreq.params.set(COMPONENT_NAME, "false");
+ }
+ }
+
/**
* Returns NamedList based on the order of
* resultIds.shardDoc.positionInResponse
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d34f549d/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java b/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
index c887277..e81ed85 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java
@@ -464,6 +464,15 @@ public class TermVectorComponent extends SearchComponent implements SolrCoreAwar
}
}
+ @Override
+ public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
+ SolrParams params = rb.req.getParams();
+ if (!params.getBool(COMPONENT_NAME, false)) return;
+ if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) == 0) {
+ sreq.params.set(COMPONENT_NAME, "false");
+ }
+ }
+
//////////////////////// NamedListInitializedPlugin methods //////////////////////
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d34f549d/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java
index dd1d5c8..10116b9 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedMLTComponentTest.java
@@ -20,11 +20,17 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.lucene.util.TestUtil;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.MoreLikeThisParams;
import org.apache.solr.common.util.NamedList;
+import org.apache.solr.search.stats.ExactStatsCache;
+import org.apache.solr.search.stats.LRUStatsCache;
+import org.apache.solr.search.stats.LocalStatsCache;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -49,6 +55,23 @@ public class DistributedMLTComponentTest extends BaseDistributedSearchTestCase {
requestHandlerName = "mltrh";
super.distribSetUp();
}
+
+ @BeforeClass
+ public static void beforeClass() {
+ int statsType = TestUtil.nextInt(random(), 1, 3);
+ if (statsType == 1) {
+ System.setProperty("solr.statsCache", ExactStatsCache.class.getName());
+ } else if (statsType == 2) {
+ System.setProperty("solr.statsCache", LRUStatsCache.class.getName());
+ } else {
+ System.setProperty("solr.statsCache", LocalStatsCache.class.getName());
+ }
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ System.clearProperty("solr.statsCache");
+ }
@Test
@ShardsFixed(num = 3)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d34f549d/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
index 5d7ff9a..0527d9e 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
@@ -18,9 +18,14 @@ package org.apache.solr.handler.component;
import org.apache.lucene.util.Constants;
+import org.apache.lucene.util.TestUtil;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.params.TermVectorParams;
+import org.apache.solr.search.stats.ExactStatsCache;
+import org.apache.solr.search.stats.LRUStatsCache;
+import org.apache.solr.search.stats.LocalStatsCache;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -29,6 +34,19 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
public static void betterNotBeJ9() {
assumeFalse("FIXME: SOLR-5792: This test fails under IBM J9",
Constants.JAVA_VENDOR.startsWith("IBM"));
+ int statsType = TestUtil.nextInt(random(), 1, 3);
+ if (statsType == 1) {
+ System.setProperty("solr.statsCache", ExactStatsCache.class.getName());
+ } else if (statsType == 2) {
+ System.setProperty("solr.statsCache", LRUStatsCache.class.getName());
+ } else {
+ System.setProperty("solr.statsCache", LocalStatsCache.class.getName());
+ }
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ System.clearProperty("solr.statsCache");
}
@Test
[05/10] lucene-solr:apiv2: LUCENE-7643,
SOLR-10013: Reenable the single-value optimization.
Posted by no...@apache.org.
LUCENE-7643,SOLR-10013: Reenable the single-value optimization.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6693c261
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6693c261
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6693c261
Branch: refs/heads/apiv2
Commit: 6693c261e5782bc49dea92002745a91215c4166e
Parents: 5bdc492
Author: Adrien Grand <jp...@gmail.com>
Authored: Mon Jan 23 10:31:44 2017 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Mon Jan 23 10:39:06 2017 +0100
----------------------------------------------------------------------
.../lucene/document/SortedNumericDocValuesRangeQuery.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6693c261/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java b/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java
index d5f75a7..18805b2 100644
--- a/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesRangeQuery.java
@@ -19,6 +19,7 @@ package org.apache.lucene.document;
import java.io.IOException;
import java.util.Objects;
+import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.LeafReaderContext;
@@ -99,11 +100,9 @@ abstract class SortedNumericDocValuesRangeQuery extends Query {
if (values == null) {
return null;
}
- final NumericDocValues singleton = null; // TODO: LUCENE-7649, re-consider optimization that broke SOLR-10013
- // final NumericDocValues singleton = DocValues.unwrapSingleton(values);
+ final NumericDocValues singleton = DocValues.unwrapSingleton(values);
final TwoPhaseIterator iterator;
if (singleton != null) {
- assert false : "imposible code -- or: someone re-enabled singleton optinization w/o reading the whole method";
iterator = new TwoPhaseIterator(singleton) {
@Override
public boolean matches() throws IOException {
[10/10] lucene-solr:apiv2: fixing merge errors
Posted by no...@apache.org.
fixing merge errors
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8d05282b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8d05282b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8d05282b
Branch: refs/heads/apiv2
Commit: 8d05282be4a1c5cc02084f665a16ef6b897f2ac8
Parents: 8999015
Author: Noble Paul <no...@apache.org>
Authored: Tue Jan 24 19:27:30 2017 +1030
Committer: Noble Paul <no...@apache.org>
Committed: Tue Jan 24 19:27:30 2017 +1030
----------------------------------------------------------------------
.../org/apache/lucene/util/RamUsageTester.java | 96 +++++++++++++++++---
1 file changed, 83 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d05282b/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java b/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
index 2c6e245..337d4be 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/util/RamUsageTester.java
@@ -16,9 +16,12 @@
*/
package org.apache.lucene.util;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.AbstractList;
@@ -30,6 +33,10 @@ import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.ToLongFunction;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
/** Crawls object graph to collect RAM usage for testing */
public final class RamUsageTester {
@@ -40,9 +47,7 @@ public final class RamUsageTester {
/** Accumulate transitive references for the provided fields of the given
* object into <code>queue</code> and return the shallow size of this object. */
public long accumulateObject(Object o, long shallowSize, Map<Field, Object> fieldValues, Collection<Object> queue) {
- for (Object value : fieldValues.values()) {
- queue.add(value);
- }
+ queue.addAll(fieldValues.values());
return shallowSize;
}
@@ -130,10 +135,10 @@ public final class RamUsageTester {
@Override
public int size() {
return len;
- }
+ }
- };
- }
+ };
+ }
totalSize += accumulator.accumulateArray(ob, shallowSize, values, stack);
} else {
/*
@@ -146,12 +151,35 @@ public final class RamUsageTester {
classCache.put(obClazz, cachedInfo = createCacheEntry(obClazz));
}
- Map<Field, Object> fieldValues = new HashMap<>();
- for (Field f : cachedInfo.referenceFields) {
- fieldValues.put(f, f.get(ob));
+ boolean needsReflection = true;
+ if (Constants.JRE_IS_MINIMUM_JAVA9 && obClazz.getName().startsWith("java.")) {
+ // Java 9: Best guess for some known types, as we cannot precisely look into runtime classes:
+ final ToLongFunction<Object> func = SIMPLE_TYPES.get(obClazz);
+ if (func != null) { // some simple type like String where the size is easy to get from public properties
+ totalSize += accumulator.accumulateObject(ob, cachedInfo.alignedShallowInstanceSize + func.applyAsLong(ob),
+ Collections.emptyMap(), stack);
+ needsReflection = false;
+ } else if (ob instanceof Iterable) {
+ final List<Object> values = StreamSupport.stream(((Iterable<?>) ob).spliterator(), false)
+ .collect(Collectors.toList());
+ totalSize += accumulator.accumulateArray(ob, cachedInfo.alignedShallowInstanceSize + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER, values, stack);
+ needsReflection = false;
+ } else if (ob instanceof Map) {
+ final List<Object> values = ((Map<?,?>) ob).entrySet().stream()
+ .flatMap(e -> Stream.of(e.getKey(), e.getValue()))
+ .collect(Collectors.toList());
+ totalSize += accumulator.accumulateArray(ob, cachedInfo.alignedShallowInstanceSize + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER, values, stack);
+ totalSize += RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;
+ needsReflection = false;
+ }
+ }
+ if (needsReflection) {
+ final Map<Field, Object> fieldValues = new HashMap<>();
+ for (Field f : cachedInfo.referenceFields) {
+ fieldValues.put(f, f.get(ob));
+ }
+ totalSize += accumulator.accumulateObject(ob, cachedInfo.alignedShallowInstanceSize, fieldValues, stack);
}
-
- totalSize += accumulator.accumulateObject(ob, cachedInfo.alignedShallowInstanceSize, fieldValues, stack);
} catch (IllegalAccessException e) {
// this should never happen as we enabled setAccessible().
throw new RuntimeException("Reflective field access failed?", e);
@@ -167,6 +195,40 @@ public final class RamUsageTester {
return totalSize;
}
+ /**
+ * This map contains a function to calculate sizes of some "simple types" like String just from their public properties.
+ * This is needed for Java 9, which does not allow to look into runtime class fields.
+ */
+ @SuppressWarnings("serial")
+ private static final Map<Class<?>, ToLongFunction<Object>> SIMPLE_TYPES = Collections.unmodifiableMap(new IdentityHashMap<Class<?>, ToLongFunction<Object>>() {
+ { init(); }
+
+ @SuppressForbidden(reason = "We measure some forbidden classes")
+ private void init() {
+ // String types:
+ a(String.class, v -> charArraySize(v.length())); // may not be correct with Java 9's compact strings!
+ a(StringBuilder.class, v -> charArraySize(v.capacity()));
+ a(StringBuffer.class, v -> charArraySize(v.capacity()));
+ // Types with large buffers:
+ a(ByteArrayOutputStream.class, v -> byteArraySize(v.size()));
+ // For File and Path, we just take the length of String representation as approximation:
+ a(File.class, v -> charArraySize(v.toString().length()));
+ a(Path.class, v -> charArraySize(v.toString().length()));
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> void a(Class<T> clazz, ToLongFunction<T> func) {
+ put(clazz, (ToLongFunction<Object>) func);
+ }
+
+ private long charArraySize(int len) {
+ return RamUsageEstimator.alignObjectSize((long)RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + (long)Character.BYTES * len);
+ }
+
+ private long byteArraySize(int len) {
+ return RamUsageEstimator.alignObjectSize((long)RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + len);
+ }
+ });
/**
* Cached information about a given class.
@@ -202,8 +264,16 @@ public final class RamUsageTester {
shallowInstanceSize = RamUsageEstimator.adjustForField(shallowInstanceSize, f);
if (!f.getType().isPrimitive()) {
- f.setAccessible(true);
- referenceFields.add(f);
+ try {
+ f.setAccessible(true);
+ referenceFields.add(f);
+ } catch (RuntimeException re) {
+ if ("java.lang.reflect.InaccessibleObjectException".equals(re.getClass().getName())) {
+ // LUCENE-7595: this is Java 9, which prevents access to fields in foreign modules
+ } else {
+ throw re;
+ }
+ }
}
}
}
[02/10] lucene-solr:apiv2: Update doap files with the latest release
6.4.0
Posted by no...@apache.org.
Update doap files with the latest release 6.4.0
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9571d0f3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9571d0f3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9571d0f3
Branch: refs/heads/apiv2
Commit: 9571d0f3ab4147e8a8e88589180f7b0174b4a6dc
Parents: 185716e
Author: Jim Ferenczi <ji...@elastic.co>
Authored: Mon Jan 23 09:50:02 2017 +0100
Committer: Jim Ferenczi <ji...@elastic.co>
Committed: Mon Jan 23 09:50:02 2017 +0100
----------------------------------------------------------------------
dev-tools/doap/lucene.rdf | 7 ++++++-
dev-tools/doap/solr.rdf | 9 +++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9571d0f3/dev-tools/doap/lucene.rdf
----------------------------------------------------------------------
diff --git a/dev-tools/doap/lucene.rdf b/dev-tools/doap/lucene.rdf
index 4fd2942..58d5328 100644
--- a/dev-tools/doap/lucene.rdf
+++ b/dev-tools/doap/lucene.rdf
@@ -15,7 +15,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
-->
<rdf:RDF xml:lang="en"
xmlns="http://usefulinc.com/ns/doap#"
@@ -68,6 +68,11 @@
<release>
<Version>
+ <name>lucene-6.4.0</name>
+ <created>2017-01-23</created>
+ <revision>6.4.0</revision>
+ </Version>
+ <Version>
<name>lucene-6.3.0</name>
<created>2016-11-08</created>
<revision>6.3.0</revision>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9571d0f3/dev-tools/doap/solr.rdf
----------------------------------------------------------------------
diff --git a/dev-tools/doap/solr.rdf b/dev-tools/doap/solr.rdf
index 95a792d..4032956 100644
--- a/dev-tools/doap/solr.rdf
+++ b/dev-tools/doap/solr.rdf
@@ -15,7 +15,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
-->
<rdf:RDF xml:lang="en"
xmlns="http://usefulinc.com/ns/doap#"
@@ -65,9 +65,14 @@
<foaf:mbox rdf:resource="mailto:dev@lucene.apache.org"/>
</foaf:Person>
</maintainer>
-
+
<release>
<Version>
+ <name>solr-6.4.0</name>
+ <created>2017-01-23</created>
+ <revision>6.4.0</revision>
+ </Version>
+ <Version>
<name>solr-6.3.0</name>
<created>2016-11-08</created>
<revision>6.3.0</revision>
[08/10] lucene-solr:apiv2: LUCENE-7653: Update randomizedtesting to
version 2.5.0. Piggyback wiping of cwds of forked JVMs.
Posted by no...@apache.org.
LUCENE-7653: Update randomizedtesting to version 2.5.0. Piggyback wiping of cwds of forked JVMs.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ca50e5b6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ca50e5b6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ca50e5b6
Branch: refs/heads/apiv2
Commit: ca50e5b61c2d8bfb703169cea2fb0ab20fd24c6b
Parents: 94e3460
Author: Dawid Weiss <dw...@apache.org>
Authored: Mon Jan 23 13:07:20 2017 +0100
Committer: Dawid Weiss <dw...@apache.org>
Committed: Mon Jan 23 13:39:19 2017 +0100
----------------------------------------------------------------------
lucene/CHANGES.txt | 2 ++
lucene/common-build.xml | 1 +
lucene/ivy-versions.properties | 2 +-
lucene/licenses/randomizedtesting-runner-2.4.0.jar.sha1 | 1 -
lucene/licenses/randomizedtesting-runner-2.5.0.jar.sha1 | 1 +
solr/licenses/junit4-ant-2.4.0.jar.sha1 | 1 -
solr/licenses/junit4-ant-2.5.0.jar.sha1 | 1 +
solr/licenses/randomizedtesting-runner-2.4.0.jar.sha1 | 1 -
solr/licenses/randomizedtesting-runner-2.5.0.jar.sha1 | 1 +
9 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4e90526..deb7078 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -116,6 +116,8 @@ Build
Also update Prettify to latest version to fix Google Chrome issue.
(Uwe Schindler)
+* LUCENE-7653: Update randomizedtesting to version 2.5.0. (Dawid Weiss)
+
======================= Lucene 6.4.0 =======================
API Changes
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/lucene/common-build.xml
----------------------------------------------------------------------
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 3b4c342..44d7353 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -976,6 +976,7 @@
shuffleOnSlave="true"
leaveTemporary="${junit4.leaveTemporary}"
seed="${tests.seed}"
+ onNonEmptyWorkDirectory="wipe"
heartbeat="${tests.heartbeat}"
uniqueSuiteNames="false"
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/lucene/ivy-versions.properties
----------------------------------------------------------------------
diff --git a/lucene/ivy-versions.properties b/lucene/ivy-versions.properties
index 6cb7f26..70e33a2 100644
--- a/lucene/ivy-versions.properties
+++ b/lucene/ivy-versions.properties
@@ -7,7 +7,7 @@
/cglib/cglib-nodep = 2.2
/com.adobe.xmp/xmpcore = 5.1.2
-com.carrotsearch.randomizedtesting.version = 2.4.0
+com.carrotsearch.randomizedtesting.version = 2.5.0
/com.carrotsearch.randomizedtesting/junit4-ant = ${com.carrotsearch.randomizedtesting.version}
/com.carrotsearch.randomizedtesting/randomizedtesting-runner = ${com.carrotsearch.randomizedtesting.version}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/lucene/licenses/randomizedtesting-runner-2.4.0.jar.sha1
----------------------------------------------------------------------
diff --git a/lucene/licenses/randomizedtesting-runner-2.4.0.jar.sha1 b/lucene/licenses/randomizedtesting-runner-2.4.0.jar.sha1
deleted file mode 100644
index 798d11c..0000000
--- a/lucene/licenses/randomizedtesting-runner-2.4.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-0222eb23dd6f45541acf6a5ac69cd9e9bdce25d2
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/lucene/licenses/randomizedtesting-runner-2.5.0.jar.sha1
----------------------------------------------------------------------
diff --git a/lucene/licenses/randomizedtesting-runner-2.5.0.jar.sha1 b/lucene/licenses/randomizedtesting-runner-2.5.0.jar.sha1
new file mode 100644
index 0000000..f4821d7
--- /dev/null
+++ b/lucene/licenses/randomizedtesting-runner-2.5.0.jar.sha1
@@ -0,0 +1 @@
+2d00ff1042ae258f33830f26f9b30fc3a43d37e1
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/solr/licenses/junit4-ant-2.4.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/junit4-ant-2.4.0.jar.sha1 b/solr/licenses/junit4-ant-2.4.0.jar.sha1
deleted file mode 100644
index 0f55c47..0000000
--- a/solr/licenses/junit4-ant-2.4.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-35ed49c7aafcceac5b0b1cb157a07dd94e09515c
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/solr/licenses/junit4-ant-2.5.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/junit4-ant-2.5.0.jar.sha1 b/solr/licenses/junit4-ant-2.5.0.jar.sha1
new file mode 100644
index 0000000..d20fe47
--- /dev/null
+++ b/solr/licenses/junit4-ant-2.5.0.jar.sha1
@@ -0,0 +1 @@
+a001f32ba5b330bb9b9b82c601771b9ad2b94eb0
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/solr/licenses/randomizedtesting-runner-2.4.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/randomizedtesting-runner-2.4.0.jar.sha1 b/solr/licenses/randomizedtesting-runner-2.4.0.jar.sha1
deleted file mode 100644
index 798d11c..0000000
--- a/solr/licenses/randomizedtesting-runner-2.4.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-0222eb23dd6f45541acf6a5ac69cd9e9bdce25d2
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ca50e5b6/solr/licenses/randomizedtesting-runner-2.5.0.jar.sha1
----------------------------------------------------------------------
diff --git a/solr/licenses/randomizedtesting-runner-2.5.0.jar.sha1 b/solr/licenses/randomizedtesting-runner-2.5.0.jar.sha1
new file mode 100644
index 0000000..f4821d7
--- /dev/null
+++ b/solr/licenses/randomizedtesting-runner-2.5.0.jar.sha1
@@ -0,0 +1 @@
+2d00ff1042ae258f33830f26f9b30fc3a43d37e1
[07/10] lucene-solr:apiv2: Revert "LUCENE-7628: Scorer.getChildren()
returns only matching Scorers"
Posted by no...@apache.org.
Revert "LUCENE-7628: Scorer.getChildren() returns only matching Scorers"
This reverts commit 5bdc492c9ca8f866d9827d83a05fbab4b95f5ce9.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/94e34603
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/94e34603
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/94e34603
Branch: refs/heads/apiv2
Commit: 94e3460305ae652531fbe55a27158490c55c8f0e
Parents: d34f549
Author: Alan Woodward <ro...@apache.org>
Authored: Mon Jan 23 11:29:21 2017 +0000
Committer: Alan Woodward <ro...@apache.org>
Committed: Mon Jan 23 11:30:03 2017 +0000
----------------------------------------------------------------------
lucene/CHANGES.txt | 5 --
.../apache/lucene/search/DisjunctionScorer.java | 4 +-
.../lucene/search/MinShouldMatchSumScorer.java | 16 +++---
.../java/org/apache/lucene/search/Scorer.java | 14 ++----
.../search/TestBooleanQueryVisitSubscorers.java | 51 ++++----------------
.../lucene/search/TestSubScorerFreqs.java | 19 +++-----
.../facet/AssertingSubDocsAtOnceCollector.java | 3 +-
.../apache/lucene/search/AssertingScorer.java | 1 -
.../org/apache/solr/ltr/LTRScoringQuery.java | 2 +-
9 files changed, 33 insertions(+), 82 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4d4dd4e..4e90526 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -77,11 +77,6 @@ API Changes
* LUCENE-7643: Replaced doc-values queries in lucene/sandbox with factory
methods on the *DocValuesField classes. (Adrien Grand)
-* LUCENE-7628: Scorer.getChildren() now only returns Scorers that are
- positioned on the current document, and can throw an IOException.
- AssertingScorer checks that getChildren() is not called on an unpositioned
- Scorer. (Alan Woodward, Adrien Grand)
-
New Features
* LUCENE-7623: Add FunctionScoreQuery and FunctionMatchQuery (Alan Woodward,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
index 8180dc4..c53942a 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
@@ -194,9 +194,9 @@ abstract class DisjunctionScorer extends Scorer {
protected abstract float score(DisiWrapper topList) throws IOException;
@Override
- public final Collection<ChildScorer> getChildren() throws IOException {
+ public final Collection<ChildScorer> getChildren() {
ArrayList<ChildScorer> children = new ArrayList<>();
- for (DisiWrapper scorer = getSubMatches(); scorer != null; scorer = scorer.next) {
+ for (DisiWrapper scorer : subScorers) {
children.add(new ChildScorer(scorer.scorer, "SHOULD"));
}
return children;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java b/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
index f7604bc..c2c419c 100644
--- a/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
@@ -20,6 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.stream.LongStream;
import java.util.stream.StreamSupport;
@@ -89,6 +90,7 @@ final class MinShouldMatchSumScorer extends Scorer {
final DisiWrapper[] tail;
int tailSize;
+ final Collection<ChildScorer> childScorers;
final long cost;
MinShouldMatchSumScorer(Weight weight, Collection<Scorer> scorers, int minShouldMatch) {
@@ -113,17 +115,17 @@ final class MinShouldMatchSumScorer extends Scorer {
addLead(new DisiWrapper(scorer));
}
+ List<ChildScorer> children = new ArrayList<>();
+ for (Scorer scorer : scorers) {
+ children.add(new ChildScorer(scorer, "SHOULD"));
+ }
+ this.childScorers = Collections.unmodifiableCollection(children);
this.cost = cost(scorers.stream().map(Scorer::iterator).mapToLong(DocIdSetIterator::cost), scorers.size(), minShouldMatch);
}
@Override
- public final Collection<ChildScorer> getChildren() throws IOException {
- List<ChildScorer> matchingScorers = new ArrayList<>();
- updateFreq();
- for (DisiWrapper s = lead; s != null; s = s.next) {
- matchingScorers.add(new ChildScorer(s.scorer, "SHOULD"));
- }
- return matchingScorers;
+ public final Collection<ChildScorer> getChildren() {
+ return childScorers;
}
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/core/src/java/org/apache/lucene/search/Scorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/Scorer.java b/lucene/core/src/java/org/apache/lucene/search/Scorer.java
index 4387f8d..f434327 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Scorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Scorer.java
@@ -77,17 +77,9 @@ public abstract class Scorer {
return weight;
}
- /**
- * Returns child sub-scorers positioned on the current document
- *
- * Note that this method should not be called on Scorers passed to {@link LeafCollector#setScorer(Scorer)},
- * as these may be synthetic Scorers produced by {@link BulkScorer} which will throw an Exception.
- *
- * This method should only be called when the Scorer is positioned
- *
- * @lucene.experimental
- */
- public Collection<ChildScorer> getChildren() throws IOException {
+ /** Returns child sub-scorers
+ * @lucene.experimental */
+ public Collection<ChildScorer> getChildren() {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
index 092106d..38ddcab 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
@@ -169,7 +169,7 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
};
}
- private void fillLeaves(Scorer scorer, Set<Scorer> set) throws IOException {
+ private void fillLeaves(Scorer scorer, Set<Scorer> set) {
if (scorer.getWeight().getQuery() instanceof TermQuery) {
set.add(scorer);
} else {
@@ -186,40 +186,7 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
public int freq(int doc) throws IOException {
return docCounts.get(doc);
}
-
- }
-
- public void testDisjunctionMatches() throws IOException {
- BooleanQuery.Builder bq1 = new BooleanQuery.Builder();
- bq1.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
- bq1.add(new PhraseQuery(F2, "search", "engine"), Occur.SHOULD);
-
- Weight w1 = scorerSearcher.createNormalizedWeight(bq1.build(), true);
- Scorer s1 = w1.scorer(reader.leaves().get(0));
- assertEquals(0, s1.iterator().nextDoc());
- assertEquals(2, s1.getChildren().size());
-
- BooleanQuery.Builder bq2 = new BooleanQuery.Builder();
- bq2.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
- bq2.add(new PhraseQuery(F2, "search", "library"), Occur.SHOULD);
-
- Weight w2 = scorerSearcher.createNormalizedWeight(bq2.build(), true);
- Scorer s2 = w2.scorer(reader.leaves().get(0));
- assertEquals(0, s2.iterator().nextDoc());
- assertEquals(1, s2.getChildren().size());
- }
-
- public void testMinShouldMatchMatches() throws IOException {
- BooleanQuery.Builder bq = new BooleanQuery.Builder();
- bq.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
- bq.add(new TermQuery(new Term(F2, "lucene")), Occur.SHOULD);
- bq.add(new PhraseQuery(F2, "search", "library"), Occur.SHOULD);
- bq.setMinimumNumberShouldMatch(2);
-
- Weight w = scorerSearcher.createNormalizedWeight(bq.build(), true);
- Scorer s = w.scorer(reader.leaves().get(0));
- assertEquals(0, s.iterator().nextDoc());
- assertEquals(2, s.getChildren().size());
+
}
public void testGetChildrenMinShouldMatchSumScorer() throws IOException {
@@ -236,12 +203,12 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
for (String summary : collector.getSummaries()) {
assertEquals(
"ConjunctionScorer\n" +
- " MUST ConstantScoreScorer\n" +
- " MUST MinShouldMatchSumScorer\n" +
- " SHOULD TermScorer body:web\n" +
- " SHOULD TermScorer body:crawler\n" +
- " SHOULD TermScorer body:nutch",
- summary);
+ " MUST ConstantScoreScorer\n" +
+ " MUST MinShouldMatchSumScorer\n" +
+ " SHOULD TermScorer body:nutch\n" +
+ " SHOULD TermScorer body:crawler\n" +
+ " SHOULD TermScorer body:web",
+ summary);
}
}
@@ -294,7 +261,7 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
};
}
- private static void summarizeScorer(final StringBuilder builder, final Scorer scorer, final int indent) throws IOException {
+ private static void summarizeScorer(final StringBuilder builder, final Scorer scorer, final int indent) {
builder.append(scorer.getClass().getSimpleName());
if (scorer instanceof TermScorer) {
TermQuery termQuery = (TermQuery) scorer.getWeight().getQuery();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java b/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
index a19dac9..121e48d 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
@@ -68,6 +68,7 @@ public class TestSubScorerFreqs extends LuceneTestCase {
private static class CountingCollector extends FilterCollector {
public final Map<Integer, Map<Query, Float>> docCounts = new HashMap<>();
+ private final Map<Query, Scorer> subScorers = new HashMap<>();
private final Set<String> relationships;
public CountingCollector(Collector other) {
@@ -78,29 +79,24 @@ public class TestSubScorerFreqs extends LuceneTestCase {
super(other);
this.relationships = relationships;
}
-
- private Map<Query, Scorer> getSubScorers(Scorer scorer) throws IOException {
- Map<Query, Scorer> collected = new HashMap<>();
+
+ public void setSubScorers(Scorer scorer, String relationship) {
for (ChildScorer child : scorer.getChildren()) {
if (scorer instanceof AssertingScorer || relationships.contains(child.relationship)) {
- collected.put(scorer.getWeight().getQuery(), scorer);
+ setSubScorers(child.child, child.relationship);
}
- collected.putAll(getSubScorers(child.child));
}
- return collected;
+ subScorers.put(scorer.getWeight().getQuery(), scorer);
}
public LeafCollector getLeafCollector(LeafReaderContext context)
throws IOException {
final int docBase = context.docBase;
return new FilterLeafCollector(super.getLeafCollector(context)) {
-
- Scorer scorer;
-
+
@Override
public void collect(int doc) throws IOException {
final Map<Query, Float> freqs = new HashMap<Query, Float>();
- final Map<Query, Scorer> subScorers = getSubScorers(scorer);
for (Map.Entry<Query, Scorer> ent : subScorers.entrySet()) {
Scorer value = ent.getValue();
int matchId = value.docID();
@@ -113,7 +109,8 @@ public class TestSubScorerFreqs extends LuceneTestCase {
@Override
public void setScorer(Scorer scorer) throws IOException {
super.setScorer(scorer);
- this.scorer = scorer;
+ subScorers.clear();
+ setSubScorers(scorer, "TOP");
}
};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
----------------------------------------------------------------------
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java b/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
index e545244..793cc412 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
@@ -16,7 +16,6 @@
*/
package org.apache.lucene.facet;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -33,7 +32,7 @@ class AssertingSubDocsAtOnceCollector extends SimpleCollector {
List<Scorer> allScorers;
@Override
- public void setScorer(Scorer s) throws IOException {
+ public void setScorer(Scorer s) {
// Gathers all scorers, including s and "under":
allScorers = new ArrayList<>();
allScorers.add(s);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/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 f7149a3..1aad140 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
@@ -78,7 +78,6 @@ public class AssertingScorer extends Scorer {
// collectors (e.g. ToParentBlockJoinCollector) that
// need to walk the scorer tree will miss/skip the
// Scorer we wrap:
- assert iterating();
return Collections.singletonList(new ChildScorer(in, "SHOULD"));
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/94e34603/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
index 37990ea..b581dd5 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
@@ -502,7 +502,7 @@ public class LTRScoringQuery extends Query {
}
@Override
- public Collection<ChildScorer> getChildren() throws IOException {
+ public Collection<ChildScorer> getChildren() {
return featureTraversalScorer.getChildren();
}
[04/10] lucene-solr:apiv2: LUCENE-7628: Scorer.getChildren() returns
only matching Scorers
Posted by no...@apache.org.
LUCENE-7628: Scorer.getChildren() returns only matching Scorers
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5bdc492c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5bdc492c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5bdc492c
Branch: refs/heads/apiv2
Commit: 5bdc492c9ca8f866d9827d83a05fbab4b95f5ce9
Parents: c7fdd10
Author: Alan Woodward <ro...@apache.org>
Authored: Mon Jan 16 14:45:45 2017 +0000
Committer: Alan Woodward <ro...@apache.org>
Committed: Mon Jan 23 09:35:16 2017 +0000
----------------------------------------------------------------------
lucene/CHANGES.txt | 5 ++
.../apache/lucene/search/DisjunctionScorer.java | 4 +-
.../lucene/search/MinShouldMatchSumScorer.java | 16 +++---
.../java/org/apache/lucene/search/Scorer.java | 14 ++++--
.../search/TestBooleanQueryVisitSubscorers.java | 51 ++++++++++++++++----
.../lucene/search/TestSubScorerFreqs.java | 19 +++++---
.../facet/AssertingSubDocsAtOnceCollector.java | 3 +-
.../apache/lucene/search/AssertingScorer.java | 1 +
.../org/apache/solr/ltr/LTRScoringQuery.java | 2 +-
9 files changed, 82 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 4e90526..4d4dd4e 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -77,6 +77,11 @@ API Changes
* LUCENE-7643: Replaced doc-values queries in lucene/sandbox with factory
methods on the *DocValuesField classes. (Adrien Grand)
+* LUCENE-7628: Scorer.getChildren() now only returns Scorers that are
+ positioned on the current document, and can throw an IOException.
+ AssertingScorer checks that getChildren() is not called on an unpositioned
+ Scorer. (Alan Woodward, Adrien Grand)
+
New Features
* LUCENE-7623: Add FunctionScoreQuery and FunctionMatchQuery (Alan Woodward,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
index c53942a..8180dc4 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
@@ -194,9 +194,9 @@ abstract class DisjunctionScorer extends Scorer {
protected abstract float score(DisiWrapper topList) throws IOException;
@Override
- public final Collection<ChildScorer> getChildren() {
+ public final Collection<ChildScorer> getChildren() throws IOException {
ArrayList<ChildScorer> children = new ArrayList<>();
- for (DisiWrapper scorer : subScorers) {
+ for (DisiWrapper scorer = getSubMatches(); scorer != null; scorer = scorer.next) {
children.add(new ChildScorer(scorer.scorer, "SHOULD"));
}
return children;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java b/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
index c2c419c..f7604bc 100644
--- a/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
@@ -20,7 +20,6 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.stream.LongStream;
import java.util.stream.StreamSupport;
@@ -90,7 +89,6 @@ final class MinShouldMatchSumScorer extends Scorer {
final DisiWrapper[] tail;
int tailSize;
- final Collection<ChildScorer> childScorers;
final long cost;
MinShouldMatchSumScorer(Weight weight, Collection<Scorer> scorers, int minShouldMatch) {
@@ -115,17 +113,17 @@ final class MinShouldMatchSumScorer extends Scorer {
addLead(new DisiWrapper(scorer));
}
- List<ChildScorer> children = new ArrayList<>();
- for (Scorer scorer : scorers) {
- children.add(new ChildScorer(scorer, "SHOULD"));
- }
- this.childScorers = Collections.unmodifiableCollection(children);
this.cost = cost(scorers.stream().map(Scorer::iterator).mapToLong(DocIdSetIterator::cost), scorers.size(), minShouldMatch);
}
@Override
- public final Collection<ChildScorer> getChildren() {
- return childScorers;
+ public final Collection<ChildScorer> getChildren() throws IOException {
+ List<ChildScorer> matchingScorers = new ArrayList<>();
+ updateFreq();
+ for (DisiWrapper s = lead; s != null; s = s.next) {
+ matchingScorers.add(new ChildScorer(s.scorer, "SHOULD"));
+ }
+ return matchingScorers;
}
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/core/src/java/org/apache/lucene/search/Scorer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/Scorer.java b/lucene/core/src/java/org/apache/lucene/search/Scorer.java
index f434327..4387f8d 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Scorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Scorer.java
@@ -77,9 +77,17 @@ public abstract class Scorer {
return weight;
}
- /** Returns child sub-scorers
- * @lucene.experimental */
- public Collection<ChildScorer> getChildren() {
+ /**
+ * Returns child sub-scorers positioned on the current document
+ *
+ * Note that this method should not be called on Scorers passed to {@link LeafCollector#setScorer(Scorer)},
+ * as these may be synthetic Scorers produced by {@link BulkScorer} which will throw an Exception.
+ *
+ * This method should only be called when the Scorer is positioned
+ *
+ * @lucene.experimental
+ */
+ public Collection<ChildScorer> getChildren() throws IOException {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
index 38ddcab..092106d 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
@@ -169,7 +169,7 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
};
}
- private void fillLeaves(Scorer scorer, Set<Scorer> set) {
+ private void fillLeaves(Scorer scorer, Set<Scorer> set) throws IOException {
if (scorer.getWeight().getQuery() instanceof TermQuery) {
set.add(scorer);
} else {
@@ -186,7 +186,40 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
public int freq(int doc) throws IOException {
return docCounts.get(doc);
}
-
+
+ }
+
+ public void testDisjunctionMatches() throws IOException {
+ BooleanQuery.Builder bq1 = new BooleanQuery.Builder();
+ bq1.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
+ bq1.add(new PhraseQuery(F2, "search", "engine"), Occur.SHOULD);
+
+ Weight w1 = scorerSearcher.createNormalizedWeight(bq1.build(), true);
+ Scorer s1 = w1.scorer(reader.leaves().get(0));
+ assertEquals(0, s1.iterator().nextDoc());
+ assertEquals(2, s1.getChildren().size());
+
+ BooleanQuery.Builder bq2 = new BooleanQuery.Builder();
+ bq2.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
+ bq2.add(new PhraseQuery(F2, "search", "library"), Occur.SHOULD);
+
+ Weight w2 = scorerSearcher.createNormalizedWeight(bq2.build(), true);
+ Scorer s2 = w2.scorer(reader.leaves().get(0));
+ assertEquals(0, s2.iterator().nextDoc());
+ assertEquals(1, s2.getChildren().size());
+ }
+
+ public void testMinShouldMatchMatches() throws IOException {
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
+ bq.add(new TermQuery(new Term(F1, "lucene")), Occur.SHOULD);
+ bq.add(new TermQuery(new Term(F2, "lucene")), Occur.SHOULD);
+ bq.add(new PhraseQuery(F2, "search", "library"), Occur.SHOULD);
+ bq.setMinimumNumberShouldMatch(2);
+
+ Weight w = scorerSearcher.createNormalizedWeight(bq.build(), true);
+ Scorer s = w.scorer(reader.leaves().get(0));
+ assertEquals(0, s.iterator().nextDoc());
+ assertEquals(2, s.getChildren().size());
}
public void testGetChildrenMinShouldMatchSumScorer() throws IOException {
@@ -203,12 +236,12 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
for (String summary : collector.getSummaries()) {
assertEquals(
"ConjunctionScorer\n" +
- " MUST ConstantScoreScorer\n" +
- " MUST MinShouldMatchSumScorer\n" +
- " SHOULD TermScorer body:nutch\n" +
- " SHOULD TermScorer body:crawler\n" +
- " SHOULD TermScorer body:web",
- summary);
+ " MUST ConstantScoreScorer\n" +
+ " MUST MinShouldMatchSumScorer\n" +
+ " SHOULD TermScorer body:web\n" +
+ " SHOULD TermScorer body:crawler\n" +
+ " SHOULD TermScorer body:nutch",
+ summary);
}
}
@@ -261,7 +294,7 @@ public class TestBooleanQueryVisitSubscorers extends LuceneTestCase {
};
}
- private static void summarizeScorer(final StringBuilder builder, final Scorer scorer, final int indent) {
+ private static void summarizeScorer(final StringBuilder builder, final Scorer scorer, final int indent) throws IOException {
builder.append(scorer.getClass().getSimpleName());
if (scorer instanceof TermScorer) {
TermQuery termQuery = (TermQuery) scorer.getWeight().getQuery();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java b/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
index 121e48d..a19dac9 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
@@ -68,7 +68,6 @@ public class TestSubScorerFreqs extends LuceneTestCase {
private static class CountingCollector extends FilterCollector {
public final Map<Integer, Map<Query, Float>> docCounts = new HashMap<>();
- private final Map<Query, Scorer> subScorers = new HashMap<>();
private final Set<String> relationships;
public CountingCollector(Collector other) {
@@ -79,24 +78,29 @@ public class TestSubScorerFreqs extends LuceneTestCase {
super(other);
this.relationships = relationships;
}
-
- public void setSubScorers(Scorer scorer, String relationship) {
+
+ private Map<Query, Scorer> getSubScorers(Scorer scorer) throws IOException {
+ Map<Query, Scorer> collected = new HashMap<>();
for (ChildScorer child : scorer.getChildren()) {
if (scorer instanceof AssertingScorer || relationships.contains(child.relationship)) {
- setSubScorers(child.child, child.relationship);
+ collected.put(scorer.getWeight().getQuery(), scorer);
}
+ collected.putAll(getSubScorers(child.child));
}
- subScorers.put(scorer.getWeight().getQuery(), scorer);
+ return collected;
}
public LeafCollector getLeafCollector(LeafReaderContext context)
throws IOException {
final int docBase = context.docBase;
return new FilterLeafCollector(super.getLeafCollector(context)) {
-
+
+ Scorer scorer;
+
@Override
public void collect(int doc) throws IOException {
final Map<Query, Float> freqs = new HashMap<Query, Float>();
+ final Map<Query, Scorer> subScorers = getSubScorers(scorer);
for (Map.Entry<Query, Scorer> ent : subScorers.entrySet()) {
Scorer value = ent.getValue();
int matchId = value.docID();
@@ -109,8 +113,7 @@ public class TestSubScorerFreqs extends LuceneTestCase {
@Override
public void setScorer(Scorer scorer) throws IOException {
super.setScorer(scorer);
- subScorers.clear();
- setSubScorers(scorer, "TOP");
+ this.scorer = scorer;
}
};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
----------------------------------------------------------------------
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java b/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
index 793cc412..e545244 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
@@ -16,6 +16,7 @@
*/
package org.apache.lucene.facet;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +33,7 @@ class AssertingSubDocsAtOnceCollector extends SimpleCollector {
List<Scorer> allScorers;
@Override
- public void setScorer(Scorer s) {
+ public void setScorer(Scorer s) throws IOException {
// Gathers all scorers, including s and "under":
allScorers = new ArrayList<>();
allScorers.add(s);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/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 1aad140..f7149a3 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
@@ -78,6 +78,7 @@ public class AssertingScorer extends Scorer {
// collectors (e.g. ToParentBlockJoinCollector) that
// need to walk the scorer tree will miss/skip the
// Scorer we wrap:
+ assert iterating();
return Collections.singletonList(new ChildScorer(in, "SHOULD"));
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5bdc492c/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
index b581dd5..37990ea 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/LTRScoringQuery.java
@@ -502,7 +502,7 @@ public class LTRScoringQuery extends Query {
}
@Override
- public Collection<ChildScorer> getChildren() {
+ public Collection<ChildScorer> getChildren() throws IOException {
return featureTraversalScorer.getChildren();
}