This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 24320d42e10 SOLR-17625: NamedList.findRecursive -> _get (#3355)
24320d42e10 is described below
commit 24320d42e100400a7cbe6033e922b3bc74973f76
Author: wildtusker <[email protected]>
AuthorDate: Mon Jun 2 00:06:45 2025 -0400
SOLR-17625: NamedList.findRecursive -> _get (#3355)
Replaced NamedList.findRecursive usages with _get, which can do Map
traversal, and
thus makes it easier to transition intermediate NamedLists to Maps.
(cherry picked from commit 51841d7d84235a8166ffe37f3a9df6cbe686577e)
---
solr/CHANGES.txt | 3 +++
.../src/java/org/apache/solr/cli/AssertTool.java | 2 +-
.../src/java/org/apache/solr/cli/ConfigTool.java | 2 +-
.../java/org/apache/solr/cli/HealthcheckTool.java | 7 ++++---
.../src/java/org/apache/solr/cli/StatusTool.java | 14 ++++++-------
.../solr/cloud/api/collections/SplitShardCmd.java | 5 +++--
.../solr/handler/component/SearchHandler.java | 11 ++++++----
.../apache/solr/packagemanager/PackageManager.java | 2 +-
.../apache/solr/cloud/CollectionsAPISolrJTest.java | 20 ++++++++++--------
.../org/apache/solr/cloud/TestPullReplica.java | 2 +-
.../apache/solr/cloud/TestPullReplicaWithAuth.java | 6 +++---
.../solr/cloud/TestSkipOverseerOperations.java | 7 +++++--
.../org/apache/solr/cloud/TestTlogReplica.java | 4 ++--
.../TestRequestStatusCollectionAPI.java | 7 ++++---
.../handler/FieldAnalysisRequestHandlerTest.java | 2 +-
.../solr/handler/admin/MetricsHandlerTest.java | 17 +++++++--------
.../DistributedSpellCheckComponentTest.java | 2 +-
.../component/DistributedTermsComponentTest.java | 4 ++--
.../org/apache/solr/highlight/HighlighterTest.java | 4 +++-
.../search/facet/SpatialHeatmapFacetsTest.java | 14 ++++++-------
.../search/facet/TestCloudJSONFacetSKGEquiv.java | 3 ++-
.../solrj/impl/CloudHttp2SolrClientTest.java | 2 +-
.../client/solrj/impl/CloudSolrClientTest.java | 2 +-
.../org/apache/solr/common/util/NamedListTest.java | 24 +++++++++++-----------
.../apache/solr/handler/BackupStatusChecker.java | 5 +++--
25 files changed, 96 insertions(+), 75 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9f7b6ba8c31..2af51003eae 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -153,6 +153,9 @@ Other Changes
* SOLR-17741: Deprecated 'addHttpRequestToContext', removed in 10. (David
Smiley)
+* SOLR-17625: Replaced NamedList.findRecursive usages with _get, which can do
Map traversal, and
+ thus makes it easier to transition intermediate NamedLists to Maps. (Gaurav
Tuli)
+
================== 9.8.1 ==================
Bug Fixes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/cli/AssertTool.java
b/solr/core/src/java/org/apache/solr/cli/AssertTool.java
index 8754dbdd885..3bdf534027b 100644
--- a/solr/core/src/java/org/apache/solr/cli/AssertTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/AssertTool.java
@@ -387,7 +387,7 @@ public class AssertTool extends ToolBase {
System.nanoTime() + TimeUnit.NANOSECONDS.convert(timeoutMs,
TimeUnit.MILLISECONDS);
try (SolrClient solrClient = SolrCLI.getSolrClient(url)) {
NamedList<Object> response = solrClient.request(new
HealthCheckRequest());
- Integer statusCode = (Integer) response.findRecursive("responseHeader",
"status");
+ Integer statusCode = (Integer) response._get(List.of("responseHeader",
"status"), null);
SolrCLI.checkCodeForAuthError(statusCode);
} catch (IOException | SolrServerException e) {
log.debug("Opening connection to {} failed, Solr does not seem to be
running", url, e);
diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java
b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java
index 53d25377801..19d2cb7200a 100644
--- a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java
@@ -142,7 +142,7 @@ public class ConfigTool extends ToolBase {
try (SolrClient solrClient = SolrCLI.getSolrClient(solrUrl)) {
NamedList<Object> result = SolrCLI.postJsonToSolr(solrClient,
updatePath, jsonBody);
- Integer statusCode = (Integer) result.findRecursive("responseHeader",
"status");
+ Integer statusCode = (Integer) result._get(List.of("responseHeader",
"status"), null);
if (statusCode == 0) {
if (value != null) {
echo("Successfully " + action + " " + property + " to " + value);
diff --git a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java
b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java
index 075a2270050..827d8ec82b0 100644
--- a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java
@@ -181,9 +181,10 @@ public class HealthcheckTool extends ToolBase {
solrClient.request(
new GenericSolrRequest(
SolrRequest.METHOD.GET,
CommonParams.SYSTEM_INFO_PATH));
- uptime = SolrCLI.uptime((Long) systemInfo.findRecursive("jvm",
"jmx", "upTimeMS"));
- String usedMemory = (String) systemInfo.findRecursive("jvm",
"memory", "used");
- String totalMemory = (String) systemInfo.findRecursive("jvm",
"memory", "total");
+ uptime =
+ SolrCLI.uptime((Long) systemInfo._get(List.of("jvm", "jmx",
"upTimeMS"), null));
+ String usedMemory = systemInfo._getStr(List.of("jvm", "memory",
"used"), null);
+ String totalMemory = systemInfo._getStr(List.of("jvm", "memory",
"total"), null);
memory = usedMemory + " of " + totalMemory;
}
diff --git a/solr/core/src/java/org/apache/solr/cli/StatusTool.java
b/solr/core/src/java/org/apache/solr/cli/StatusTool.java
index b6be110107a..712bf78972b 100644
--- a/solr/core/src/java/org/apache/solr/cli/StatusTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/StatusTool.java
@@ -333,12 +333,12 @@ public class StatusTool extends ToolBase {
String solrHome = (String) info.get("solr_home");
status.put("solr_home", solrHome != null ? solrHome : "?");
- status.put("version", info.findRecursive("lucene", "solr-impl-version"));
- status.put("startTime", info.findRecursive("jvm", "jmx",
"startTime").toString());
- status.put("uptime", SolrCLI.uptime((Long) info.findRecursive("jvm",
"jmx", "upTimeMS")));
+ status.put("version", info._getStr(List.of("lucene", "solr-impl-version"),
null));
+ status.put("startTime", info._getStr(List.of("jvm", "jmx", "startTime"),
null));
+ status.put("uptime", SolrCLI.uptime((Long) info._get(List.of("jvm", "jmx",
"upTimeMS"), null)));
- String usedMemory = (String) info.findRecursive("jvm", "memory", "used");
- String totalMemory = (String) info.findRecursive("jvm", "memory", "total");
+ String usedMemory = info._getStr(List.of("jvm", "memory", "used"), null);
+ String totalMemory = info._getStr(List.of("jvm", "memory", "total"), null);
status.put("memory", usedMemory + " of " + totalMemory);
// if this is a Solr in solrcloud mode, gather some basic cluster info
@@ -363,11 +363,11 @@ public class StatusTool extends ToolBase {
// TODO add booleans to request just what we want; not everything
NamedList<Object> json = solrClient.request(new
CollectionAdminRequest.ClusterStatus());
- List<String> liveNodes = (List<String>) json.findRecursive("cluster",
"live_nodes");
+ List<String> liveNodes = (List<String>) json._get(List.of("cluster",
"live_nodes"), null);
cloudStatus.put("liveNodes", String.valueOf(liveNodes.size()));
// TODO get this as a metric from the metrics API instead, or something
else.
- var collections = (Map<String, Object>) json.findRecursive("cluster",
"collections");
+ var collections = (Map<String, Object>) json._get(List.of("cluster",
"collections"), null);
cloudStatus.put("collections", String.valueOf(collections.size()));
return cloudStatus;
diff --git
a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
index 905b3712888..6d6ce8c428d 100644
---
a/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
+++
b/solr/core/src/java/org/apache/solr/cloud/api/collections/SplitShardCmd.java
@@ -889,14 +889,15 @@ public class SplitShardCmd implements
CollApiCmds.CollectionApiCommand {
new GenericSolrRequest(SolrRequest.METHOD.GET, "/admin/metrics",
params)
.process(cloudManager.getSolrClient());
- Number size = (Number) rsp.getResponse().findRecursive("metrics",
indexSizeMetricName);
+ Number size = (Number) rsp.getResponse()._get(List.of("metrics",
indexSizeMetricName), null);
if (size == null) {
log.warn("cannot verify information for parent shard leader");
return;
}
double indexSize = size.doubleValue();
- Number freeSize = (Number) rsp.getResponse().findRecursive("metrics",
freeDiskSpaceMetricName);
+ Number freeSize =
+ (Number) rsp.getResponse()._get(List.of("metrics",
freeDiskSpaceMetricName), null);
if (freeSize == null) {
log.warn("missing node disk space information for parent shard leader");
return;
diff --git
a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
index 1fb8cbc6855..0b34e6ffdef 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
@@ -609,15 +609,18 @@ public class SearchHandler extends RequestHandlerBase
if (resp == null) {
return false;
}
- Object recursive =
resp.findRecursive("responseHeader", "partialResults");
+ Object recursive =
+ resp._get(List.of("responseHeader",
"partialResults"), null);
if (recursive != null) {
Object message =
"[Shard:"
+ response.getShardAddress()
+ "]"
- + resp.findRecursive(
- "responseHeader",
-
RESPONSE_HEADER_PARTIAL_RESULTS_DETAILS_KEY);
+ + resp._get(
+ List.of(
+ "responseHeader",
+
RESPONSE_HEADER_PARTIAL_RESULTS_DETAILS_KEY),
+ null);
detailMesg.compareAndSet(null, message); // first
one, ingore rest
}
return recursive != null;
diff --git
a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
index 5e258c83383..159b192a1ec 100644
--- a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
+++ b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
@@ -283,7 +283,7 @@ public class PackageManager implements Closeable {
NamedList<Object> response =
solrClient.request(
new GenericV2SolrRequest(SolrRequest.METHOD.GET,
PackageUtils.CLUSTERPROPS_PATH));
- Integer statusCode = (Integer) response.findRecursive("responseHeader",
"status");
+ Integer statusCode = (Integer) response._get(List.of("responseHeader",
"status"), null);
if (statusCode == null || statusCode == ErrorCode.NOT_FOUND.code) {
// Cluster props doesn't exist, that means there are no cluster level
plugins installed.
result = Collections.emptyMap();
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 6bc5e0c6e9f..caa303d3754 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
@@ -291,8 +291,8 @@ public class CollectionsAPISolrJTest extends
SolrCloudTestCase {
cluster.waitForActiveCollection(collectionName, 2, 4);
- String nodeName = (String) response._get("success[0]/key", null);
- String corename = (String) response._get(asList("success", nodeName,
"core"), null);
+ String nodeName = response._getStr("success[0]/key", null);
+ String corename = response._getStr(asList("success", nodeName, "core"),
null);
try (SolrClient coreClient =
getHttpSolrClient(cluster.getZkStateReader().getBaseUrlForNodeName(nodeName))) {
@@ -629,19 +629,23 @@ public class CollectionsAPISolrJTest extends
SolrCloudTestCase {
CollectionAdminResponse rsp = req.process(cluster.getSolrClient());
assertEquals(0, rsp.getStatus());
assertNotNull(rsp.getResponse().get(collectionName));
- assertNotNull(rsp.getResponse().findRecursive(collectionName,
"properties"));
+ assertNotNull(rsp.getResponse()._get(List.of(collectionName,
"properties"), null));
final var collPropMap =
- (Map<String, Object>) rsp.getResponse().findRecursive(collectionName,
"properties");
+ (Map<String, Object>) rsp.getResponse()._get(List.of(collectionName,
"properties"), null);
assertEquals("conf2", collPropMap.get("configName"));
assertEquals(2L, collPropMap.get("nrtReplicas"));
assertEquals("0", collPropMap.get("tlogReplicas"));
assertEquals("0", collPropMap.get("pullReplicas"));
assertEquals(
- 2, ((NamedList<Object>)
rsp.getResponse().findRecursive(collectionName, "shards")).size());
- assertNotNull(rsp.getResponse().findRecursive(collectionName, "shards",
"shard1", "leader"));
+ 2,
+ ((NamedList<Object>) rsp.getResponse()._get(List.of(collectionName,
"shards"), null))
+ .size());
+ assertNotNull(
+ rsp.getResponse()._get(List.of(collectionName, "shards", "shard1",
"leader"), null));
// Ensure more advanced info is not returned
assertNull(
- rsp.getResponse().findRecursive(collectionName, "shards", "shard1",
"leader", "segInfos"));
+ rsp.getResponse()
+ ._get(List.of(collectionName, "shards", "shard1", "leader",
"segInfos"), null));
// Returns segment metadata iff requested
req = CollectionAdminRequest.collectionStatus(collectionName);
@@ -698,7 +702,7 @@ public class CollectionsAPISolrJTest extends
SolrCloudTestCase {
assertEquals(0, rsp.getStatus());
@SuppressWarnings({"unchecked"})
List<Object> nonCompliant =
- (List<Object>) rsp.getResponse().findRecursive(collectionName,
"schemaNonCompliant");
+ (List<Object>) rsp.getResponse()._get(List.of(collectionName,
"schemaNonCompliant"), null);
assertEquals(nonCompliant.toString(), 1, nonCompliant.size());
assertTrue(nonCompliant.toString(), nonCompliant.contains("(NONE)"));
@SuppressWarnings({"unchecked"})
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
index 32807418908..88bbb6a4997 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
@@ -318,7 +318,7 @@ public class TestPullReplica extends SolrCloudTestCase {
"Replicas shouldn't process the add document request: " +
statsResponse,
((Map<String, Object>)
(statsResponse.getResponse())
- .findRecursive("plugins", "UPDATE", "updateHandler",
"stats"))
+ ._get(List.of("plugins", "UPDATE", "updateHandler",
"stats"), null))
.get("UPDATE.updateHandler.adds"));
}
}
diff --git
a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java
b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java
index 63ae8044618..2f3ed6219ed 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaWithAuth.java
@@ -43,6 +43,7 @@ import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.Utils;
import org.apache.solr.security.BasicAuthPlugin;
import org.apache.solr.security.RuleBasedAuthorizationPlugin;
@@ -179,10 +180,9 @@ public class TestPullReplicaWithAuth extends
SolrCloudTestCase {
@SuppressWarnings("unchecked")
private Object getUpdateHandlerMetric(QueryResponse statsResponse, String
metric) {
+ NamedList<Object> entries = statsResponse.getResponse();
return ((Map<String, Object>)
- statsResponse
- .getResponse()
- .findRecursive("plugins", "UPDATE", "updateHandler", "stats"))
+ entries._get(List.of("plugins", "UPDATE", "updateHandler",
"stats"), null))
.get(metric);
}
}
diff --git
a/solr/core/src/test/org/apache/solr/cloud/TestSkipOverseerOperations.java
b/solr/core/src/test/org/apache/solr/cloud/TestSkipOverseerOperations.java
index 57a88d0ea58..3219d0e05e8 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSkipOverseerOperations.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSkipOverseerOperations.java
@@ -29,6 +29,7 @@ import
org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.cloud.LiveNodesPredicate;
import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.NamedList;
import org.apache.solr.embedded.JettySolrRunner;
import org.junit.After;
import org.junit.Before;
@@ -237,7 +238,8 @@ public class TestSkipOverseerOperations extends
SolrCloudTestCase {
* <p>The update happens in
org.apache.solr.cloud.Overseer.ClusterStateUpdater.processQueueItem()
*/
private int getNumLeaderOperations(CollectionAdminResponse resp) {
- return (int) resp.getResponse().findRecursive("overseer_operations",
"leader", "requests");
+ NamedList<Object> entries = resp.getResponse();
+ return (int) entries._get(List.of("overseer_operations", "leader",
"requests"), null);
}
/**
@@ -245,7 +247,8 @@ public class TestSkipOverseerOperations extends
SolrCloudTestCase {
* org.apache.solr.cloud.overseer.OverseerAction#STATE} message that sets
replica properties
*/
private int getNumStateOperations(CollectionAdminResponse resp) {
- return (int) resp.getResponse().findRecursive("overseer_operations",
"state", "requests");
+ NamedList<Object> entries = resp.getResponse();
+ return (int) entries._get(List.of("overseer_operations", "state",
"requests"), null);
}
private String getOverseerLeader() throws IOException, SolrServerException {
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
index 3d33f6da412..a421a7234de 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
@@ -284,6 +284,7 @@ public class TestTlogReplica extends SolrCloudTestCase {
"qt", "/admin/plugins",
"stats", "true");
QueryResponse statsResponse = tlogReplicaClient.query(req);
+ NamedList<Object> entries = (statsResponse.getResponse());
assertEquals(
"Append replicas should recive all updates. Replica: "
+ r
@@ -291,8 +292,7 @@ public class TestTlogReplica extends SolrCloudTestCase {
+ statsResponse,
1L,
((Map<String, Object>)
- (statsResponse.getResponse())
- .findRecursive("plugins", "UPDATE",
"updateHandler", "stats"))
+ entries._get(List.of("plugins", "UPDATE",
"updateHandler", "stats"), null))
.get("UPDATE.updateHandler.cumulativeAdds.count"));
break;
} catch (AssertionError e) {
diff --git
a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java
b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java
index 3a9f736c440..b19b1d65226 100644
---
a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java
+++
b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestRequestStatusCollectionAPI.java
@@ -21,6 +21,7 @@ import static org.hamcrest.Matchers.containsString;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrClient;
@@ -80,7 +81,7 @@ public class TestRequestStatusCollectionAPI extends
BasicDistributedZkTest {
NamedList<Object> createResponse = null;
try {
createResponse = sendStatusRequestWithRetry(params,
MAX_WAIT_TIMEOUT_SECONDS);
- message = (String) createResponse.findRecursive("status", "msg");
+ message = createResponse._getStr(List.of("status", "msg"), null);
} catch (SolrServerException | IOException e) {
log.error("error sending request", e);
}
@@ -123,7 +124,7 @@ public class TestRequestStatusCollectionAPI extends
BasicDistributedZkTest {
NamedList<Object> splitResponse = null;
try {
splitResponse = sendStatusRequestWithRetry(params,
MAX_WAIT_TIMEOUT_SECONDS);
- message = (String) splitResponse.findRecursive("status", "msg");
+ message = splitResponse._getStr(List.of("status", "msg"), null);
} catch (SolrServerException | IOException e) {
log.error("error sending request", e);
}
@@ -155,7 +156,7 @@ public class TestRequestStatusCollectionAPI extends
BasicDistributedZkTest {
try {
NamedList<Object> response = sendStatusRequestWithRetry(params,
MAX_WAIT_TIMEOUT_SECONDS);
- message = (String) response.findRecursive("status", "msg");
+ message = response._getStr(List.of("status", "msg"), null);
} catch (SolrServerException | IOException e) {
log.error("error sending request", e);
}
diff --git
a/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
b/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
index 2cc1ba80c78..36b293ed8ab 100644
---
a/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
+++
b/solr/core/src/test/org/apache/solr/handler/FieldAnalysisRequestHandlerTest.java
@@ -800,7 +800,7 @@ public class FieldAnalysisRequestHandlerTest extends
AnalysisRequestHandlerTestB
// just test that we see "900" in the flags attribute here
@SuppressWarnings({"unchecked", "rawtypes"})
List<NamedList> tokenInfoList =
- (List<NamedList>) result.findRecursive("index",
CustomTokenFilter.class.getName());
+ (List<NamedList>) result._get(List.of("index",
CustomTokenFilter.class.getName()), null);
// '1' from CustomTokenFilter plus 900 from CustomFlagsAttributeImpl.
assertEquals(
901,
diff --git
a/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
b/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
index 4c3709f5ae5..dffbdae399c 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/MetricsHandlerTest.java
@@ -27,6 +27,7 @@ import io.prometheus.metrics.model.snapshots.MetricSnapshot;
import io.prometheus.metrics.model.snapshots.MetricSnapshots;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.MapWriter;
@@ -479,7 +480,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
key1),
resp);
NamedList<?> values = resp.getValues();
- Object val = values.findRecursive("metrics", key1);
+ Object val = values._get(List.of("metrics", key1), null);
assertNotNull(val);
assertTrue(val instanceof MapWriter);
assertTrue(((MapWriter) val)._size() >= 2);
@@ -573,8 +574,8 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
values = resp.getValues();
NamedList<?> metrics = (NamedList<?>) values.get("metrics");
assertEquals(0, metrics.size());
- assertNotNull(values.findRecursive("errors", "foo"));
- assertNotNull(values.findRecursive("errors", "foo:bar:baz:xyz"));
+ assertNotNull(values._get(List.of("errors", "foo"), null));
+ assertNotNull(values._get(List.of("errors", "foo:bar:baz:xyz"), null));
// unknown registry
resp = new SolrQueryResponse();
@@ -590,7 +591,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
values = resp.getValues();
metrics = (NamedList<?>) values.get("metrics");
assertEquals(0, metrics.size());
- assertNotNull(values.findRecursive("errors", "foo:bar:baz"));
+ assertNotNull(values._get(List.of("errors", "foo:bar:baz"), null));
// unknown metric
resp = new SolrQueryResponse();
@@ -606,7 +607,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
values = resp.getValues();
metrics = (NamedList<?>) values.get("metrics");
assertEquals(0, metrics.size());
- assertNotNull(values.findRecursive("errors", "solr.jetty:unknown:baz"));
+ assertNotNull(values._get(List.of("errors", "solr.jetty:unknown:baz"),
null));
handler.close();
}
@@ -630,7 +631,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
// response structure is like in the case of non-key params
Object val =
resp.getValues()
- .findRecursive("metrics", "solr.core.collection1",
"QUERY./select.requestTimes");
+ ._get(List.of("metrics", "solr.core.collection1",
"QUERY./select.requestTimes"), null);
assertNotNull(val);
assertTrue(val instanceof MapWriter);
Map<String, Object> map = new HashMap<>();
@@ -655,7 +656,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
key2),
resp);
// response structure is like in the case of non-key params
- val = resp.getValues().findRecursive("metrics", "solr.core.collection1");
+ val = resp.getValues()._get(List.of("metrics", "solr.core.collection1"),
null);
assertNotNull(val);
Object v = ((SimpleOrderedMap<Object>)
val).get("QUERY./select.requestTimes");
assertNotNull(v);
@@ -689,7 +690,7 @@ public class MetricsHandlerTest extends SolrTestCaseJ4 {
MetricsHandler.EXPR_PARAM,
key3),
resp);
- val = resp.getValues().findRecursive("metrics", "solr.core.collection1");
+ val = resp.getValues()._get(List.of("metrics", "solr.core.collection1"),
null);
assertNotNull(val);
// for requestTimes only the full set of values from the first expr should
be present
assertNotNull(val);
diff --git
a/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
b/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
index 501a8863f0b..3337e87d057 100644
---
a/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
+++
b/solr/core/src/test/org/apache/solr/handler/component/DistributedSpellCheckComponentTest.java
@@ -65,7 +65,7 @@ public class DistributedSpellCheckComponentTest extends
BaseDistributedSearchTes
NamedList<Object> nl = control.getResponse();
Object explicitNumSuggestExpected =
- nl.findRecursive("responseHeader", "params",
"test.expected.suggestions");
+ nl._get(List.of("responseHeader", "params",
"test.expected.suggestions"), null);
@SuppressWarnings("unchecked")
NamedList<Object> sc = (NamedList<Object>) nl.get("spellcheck");
diff --git
a/solr/core/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java
b/solr/core/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java
index fbeda40717f..5d21b393913 100644
---
a/solr/core/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java
+++
b/solr/core/src/test/org/apache/solr/handler/component/DistributedTermsComponentTest.java
@@ -228,8 +228,8 @@ public class DistributedTermsComponentTest extends
BaseDistributedSearchTestCase
// other way is to pass whole response to compare
assertNull(
compare(
- rsp.findRecursive("terms"),
- controlRsp.findRecursive("terms"),
+ rsp._get(List.of("terms"), null),
+ controlRsp._get(List.of("terms"), null),
flags(handle, "terms"),
handle));
}
diff --git a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
index 73c47e14690..f5e0ad579f7 100644
--- a/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
+++ b/solr/core/src/test/org/apache/solr/highlight/HighlighterTest.java
@@ -36,6 +36,7 @@ import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.HighlightParams;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.NamedList;
import org.apache.solr.handler.component.HighlightComponent;
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.handler.component.SearchComponent;
@@ -1404,8 +1405,9 @@ public class HighlighterTest extends SolrTestCaseJ4 {
hlComp.prepare(rb);
hlComp.process(rb);
// inspect response
+ NamedList<Object> entries = resp.getValues();
final String[] snippets =
- (String[]) resp.getValues().findRecursive("highlighting", "0",
FIELD_NAME);
+ (String[]) entries._get(List.of("highlighting", "0", FIELD_NAME),
null);
assertEquals("<em>word|7</em> word|2", snippets[0]);
} finally {
req.close();
diff --git
a/solr/core/src/test/org/apache/solr/search/facet/SpatialHeatmapFacetsTest.java
b/solr/core/src/test/org/apache/solr/search/facet/SpatialHeatmapFacetsTest.java
index a385eeeb498..6f48e473bca 100644
---
a/solr/core/src/test/org/apache/solr/search/facet/SpatialHeatmapFacetsTest.java
+++
b/solr/core/src/test/org/apache/solr/search/facet/SpatialHeatmapFacetsTest.java
@@ -152,12 +152,12 @@ public class SpatialHeatmapFacetsTest extends
BaseDistributedSearchTestCase {
2,
response
.getResponse()
- .findRecursive("facet_counts", "facet_heatmaps", "course",
"gridLevel"));
+ ._get(List.of("facet_counts", "facet_heatmaps", "course",
"gridLevel"), null));
assertTrue(
((NamedList<Object>)
response
.getResponse()
- .findRecursive("facet_counts", "facet_heatmaps",
"course"))
+ ._get(List.of("facet_counts", "facet_heatmaps",
"course"), null))
.indexOf("counts_" + courseFormat, 0)
>= 0);
}
@@ -442,10 +442,10 @@ public class SpatialHeatmapFacetsTest extends
BaseDistributedSearchTestCase {
+ "}"));
{
final NamedList<?> q1Res =
- (NamedList<?>) response.getResponse().findRecursive("facets",
"q1");
+ (NamedList<?>) response.getResponse()._get(List.of("facets",
"q1"), null);
assertEquals("1", q1Res.get("count").toString());
- final NamedList<?> q2Res =
- (NamedList<?>) response.getResponse().findRecursive("facets",
"q2");
+ NamedList<Object> entries = response.getResponse();
+ final NamedList<?> q2Res = (NamedList<?>)
entries._get(List.of("facets", "q2"), null);
assertEquals("1", q2Res.get("count").toString());
// essentially, these will differ only in the heatmap counts but
otherwise will be the same
assertNotNull(compare(q1Res, q2Res, flags, handle));
@@ -507,12 +507,12 @@ public class SpatialHeatmapFacetsTest extends
BaseDistributedSearchTestCase {
// classic faceting
final NamedList<?> classicResp =
(NamedList<?>)
- response.getResponse().findRecursive("facet_counts",
"facet_heatmaps", FIELD);
+ response.getResponse()._get(List.of("facet_counts",
"facet_heatmaps", FIELD), null);
if (classicResp != null) {
return classicResp;
}
// JSON Facet
- return (NamedList<?>) response.getResponse().findRecursive("facets", "f1");
+ return (NamedList<?>) response.getResponse()._get(List.of("facets", "f1"),
null);
}
@Test
diff --git
a/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKGEquiv.java
b/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKGEquiv.java
index 31e1b0892ec..7a99548aa8c 100644
---
a/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKGEquiv.java
+++
b/solr/core/src/test/org/apache/solr/search/facet/TestCloudJSONFacetSKGEquiv.java
@@ -532,7 +532,8 @@ public class TestCloudJSONFacetSKGEquiv extends
SolrCloudTestCase {
// skip past the (implicit) top Facet query to get it's "sub-facets"
(the real facets)...
@SuppressWarnings({"unchecked"})
final List<NamedList<Object>> facetDebug =
- (List<NamedList<Object>>) topNamedList.findRecursive("debug",
"facet-trace", "sub-facet");
+ (List<NamedList<Object>>)
+ topNamedList._get(List.of("debug", "facet-trace", "sub-facet"),
null);
assertNotNull(topNamedList + " ... null facet debug?", facetDebug);
assertFalse(topNamedList + " ... not even one facet debug?",
facetDebug.isEmpty());
return facetDebug.get(0);
diff --git
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
index 86659a42420..5aa2e751cc2 100644
---
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
+++
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java
@@ -678,7 +678,7 @@ public class CloudHttp2SolrClientTest extends
SolrCloudTestCase {
}
@SuppressWarnings({"unchecked"})
Map<String, Object> map =
- (Map<String, Object>) resp.findRecursive("solr-mbeans", category, key,
"stats");
+ (Map<String, Object>) resp._get(List.of("solr-mbeans", category, key,
"stats"), null);
if (map == null) {
return null;
}
diff --git
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
index a5b34c329f2..78a47f24e1d 100644
---
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
+++
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientTest.java
@@ -620,7 +620,7 @@ public class CloudSolrClientTest extends SolrCloudTestCase {
}
@SuppressWarnings({"unchecked"})
Map<String, Object> map =
- (Map<String, Object>) resp.findRecursive("solr-mbeans", category, key,
"stats");
+ (Map<String, Object>) resp._get(List.of("solr-mbeans", category, key,
"stats"), null);
if (map == null) {
return null;
}
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
index 31924a4afbe..cadc88ed890 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/NamedListTest.java
@@ -142,28 +142,28 @@ public class NamedListTest extends SolrTestCase {
nl.add("key3", nl3);
// Simple three-level checks.
- String test1 = (String) nl.findRecursive("key2", "key2b", "key2b2");
+ String test1 = nl._getStr(List.of("key2", "key2b", "key2b2"), null);
assertEquals("value2b2", test1);
- String test2 = (String) nl.findRecursive("key3", "key3a", "key3a3");
+ String test2 = nl._getStr(List.of("key3", "key3a", "key3a3"), null);
assertEquals("value3a3", test2);
// Two-level check.
- String test3 = (String) nl.findRecursive("key3", "key3c");
+ String test3 = nl._getStr(List.of("key3", "key3c"), null);
assertEquals("value3c", test3);
// Checking that invalid values return null.
- String test4 = (String) nl.findRecursive("key3", "key3c", "invalid");
+ String test4 = nl._getStr(List.of("key3", "key3c", "invalid"), null);
assertNull(test4);
- String test5 = (String) nl.findRecursive("key3", "invalid", "invalid");
+ String test5 = nl._getStr(List.of("key3", "invalid", "invalid"), null);
assertNull(test5);
- String test6 = (String) nl.findRecursive("invalid", "key3c");
+ String test6 = nl._getStr(List.of("invalid", "key3c"), null);
assertNull(test6);
// Verify that retrieved NamedList objects have the right type.
- Object test7 = nl.findRecursive("key2", "key2b");
+ Object test7 = nl._get(List.of("key2", "key2b"), null);
assertTrue(test7 instanceof NamedList);
// Integer check.
- int test8 = (Integer) nl.findRecursive("key2", "k2int1");
+ int test8 = (Integer) nl._get(List.of("key2", "k2int1"), null);
assertEquals(5, test8);
// Check that a single argument works the same as get(String).
- String test9 = (String) nl.findRecursive("key1");
+ String test9 = nl._getStr(List.of("key1"), null);
assertEquals("value1", test9);
// enl == explicit nested list
//
@@ -181,15 +181,15 @@ public class NamedListTest extends SolrTestCase {
// Tests that are very similar to the test above, just repeated
// on the explicitly nested object type.
- String enltest1 = (String) enl.findRecursive("key1", "key1a");
+ String enltest1 = enl._getStr(List.of("key1", "key1a"), null);
assertEquals("value1a", enltest1);
- String enltest2 = (String) enl.findRecursive("key1", "key1b");
+ String enltest2 = enl._getStr(List.of("key1", "key1b"), null);
assertEquals("value1b", enltest2);
// Verify that when a null value is stored, the standard get method
// says it is null, then check the recursive method.
Object enltest3 = enl.get("key2");
assertNull(enltest3);
- Object enltest4 = enl.findRecursive("key2");
+ Object enltest4 = enl._get(List.of("key2"), null);
assertNull(enltest4);
}
diff --git
a/solr/test-framework/src/java/org/apache/solr/handler/BackupStatusChecker.java
b/solr/test-framework/src/java/org/apache/solr/handler/BackupStatusChecker.java
index a3e8571f8c1..77163549289 100644
---
a/solr/test-framework/src/java/org/apache/solr/handler/BackupStatusChecker.java
+++
b/solr/test-framework/src/java/org/apache/solr/handler/BackupStatusChecker.java
@@ -22,6 +22,7 @@ import static
org.apache.lucene.tests.util.LuceneTestCase.assertTrue;
import static org.apache.solr.SolrTestCaseJ4.params;
import java.lang.invoke.MethodHandles;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
@@ -196,7 +197,7 @@ public final class BackupStatusChecker {
log.info("Checking Status of {}: {}", label, data);
@SuppressWarnings({"unchecked"})
final NamedList<String> backupData =
- (NamedList<String>) data.findRecursive("details", "backup");
+ (NamedList<String>) data._get(List.of("details", "backup"), null);
if (null == backupData) {
// no backup has finished yet
return null;
@@ -273,7 +274,7 @@ public final class BackupStatusChecker {
log.info("Checking Deletion Status of {}: {}", backupName, data);
@SuppressWarnings({"unchecked"})
final NamedList<String> backupData =
- (NamedList<String>) data.findRecursive("details", "backup");
+ (NamedList<String>) data._get(List.of("details", "backup"), null);
if (null == backupData
|| null == backupData.get("status")
|| !backupName.equals(backupData.get("snapshotName"))) {