You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2019/03/15 11:04:45 UTC
[lucene-solr] branch branch_8x updated: SOLR-13292: Fix a logic bug
when point types are present, add more details to the unit test.
This is an automated email from the ASF dual-hosted git repository.
ab pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new f7e41ef SOLR-13292: Fix a logic bug when point types are present, add more details to the unit test.
f7e41ef is described below
commit f7e41ef86896d726b16391af8f44c4290fa07da5
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Fri Mar 15 11:52:37 2019 +0100
SOLR-13292: Fix a logic bug when point types are present, add more details to the unit test.
---
.../handler/admin/SegmentsInfoRequestHandler.java | 5 ++--
.../apache/solr/cloud/CollectionsAPISolrJTest.java | 30 ++++++++++++++++++++--
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
index 5b37bbb..3cc7a09 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
@@ -386,8 +386,7 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
nonCompliant.add("docValues", "schema=" + sf.getType().getUninversionType(sf) + ", segment=false");
}
if (!sf.hasDocValues() &&
- fi.getDocValuesType() != DocValuesType.NONE &&
- fi.getIndexOptions() != IndexOptions.NONE) {
+ fi.getDocValuesType() != DocValuesType.NONE) {
nonCompliant.add("docValues", "schema=false, segment=" + fi.getDocValuesType().toString());
}
if (!sf.isPolyField()) { // difficult to find all sub-fields in a general way
@@ -395,7 +394,7 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
nonCompliant.add("indexed", "schema=" + sf.indexed() + ", segment=" + fi.getIndexOptions());
}
}
- if (sf.omitNorms() != (fi.omitsNorms() || hasPoints)) {
+ if (!hasPoints && (sf.omitNorms() != fi.omitsNorms())) {
nonCompliant.add("omitNorms", "schema=" + sf.omitNorms() + ", segment=" + fi.omitsNorms());
}
if (sf.storeTermVector() != fi.hasVectors()) {
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
index 42940a8..ce02567 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
@@ -30,6 +30,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -83,6 +84,7 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
public void beforeTest() throws Exception {
configureCluster(4)
.addConfig("conf", configset("cloud-minimal"))
+ .addConfig("conf2", configset("cloud-dynamic"))
.configure();
// clear any persisted auto scaling configuration
@@ -605,15 +607,36 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
@Test
public void testColStatus() throws Exception {
final String collectionName = "collectionStatusTest";
- CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2)
+ CollectionAdminRequest.createCollection(collectionName, "conf2", 2, 2)
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(collectionName, 2, 4);
SolrClient client = cluster.getSolrClient();
+ byte[] binData = collectionName.getBytes("UTF-8");
// index some docs
for (int i = 0; i < 10; i++) {
- client.add(collectionName, new SolrInputDocument("id", String.valueOf(i)));
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", String.valueOf(i));
+ doc.addField("number_i", i);
+ doc.addField("number_l", i);
+ doc.addField("number_f", i);
+ doc.addField("number_d", i);
+ doc.addField("number_ti", i);
+ doc.addField("number_tl", i);
+ doc.addField("number_tf", i);
+ doc.addField("number_td", i);
+ doc.addField("point", i + "," + i);
+ doc.addField("pointD", i + "," + i);
+ doc.addField("store", (i * 5) + "," + (i * 5));
+ doc.addField("boolean_b", true);
+ doc.addField("multi_int_with_docvals", i);
+ doc.addField("string_s", String.valueOf(i));
+ doc.addField("tv_mv_string", "this is a test " + i);
+ doc.addField("timestamp_dt", new Date());
+ doc.addField("timestamp_tdt", new Date());
+ doc.addField("payload", binData);
+ client.add(collectionName, doc);
}
client.commit(collectionName);
@@ -624,6 +647,9 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
req.setWithSizeInfo(true);
CollectionAdminResponse rsp = req.process(cluster.getSolrClient());
assertEquals(0, rsp.getStatus());
+ List<Object> nonCompliant = (List<Object>)rsp.getResponse().findRecursive(collectionName, "schemaNonCompliant");
+ assertEquals(nonCompliant.toString(), 1, nonCompliant.size());
+ assertTrue(nonCompliant.toString(), nonCompliant.contains("(NONE)"));
NamedList<Object> segInfos = (NamedList<Object>) rsp.getResponse().findRecursive(collectionName, "shards", "shard1", "leader", "segInfos");
assertNotNull(Utils.toJSONString(rsp), segInfos.findRecursive("info", "core", "startTime"));
assertNotNull(Utils.toJSONString(rsp), segInfos.get("fieldInfoLegend"));