mirror of https://github.com/apache/lucene.git
SOLR-13292: Fix a logic bug when point types are present, add more details to the unit test.
This commit is contained in:
parent
ad457d188e
commit
571b307266
|
@ -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()) {
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue