You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2023/02/23 12:57:01 UTC
[solr] branch branch_9x updated: SOLR-16672: Remove use of setDefaultCollection in SolrCLI (#1372)
This is an automated email from the ASF dual-hosted git repository.
epugh 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 57f0ef442a3 SOLR-16672: Remove use of setDefaultCollection in SolrCLI (#1372)
57f0ef442a3 is described below
commit 57f0ef442a393e0a05859534734937fc31ed7ffb
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Thu Feb 23 07:56:06 2023 -0500
SOLR-16672: Remove use of setDefaultCollection in SolrCLI (#1372)
Simplify how the Healthcheck command gets it target collection and eradicate an unneeded setDefaultCollection method.
---
solr/CHANGES.txt | 2 ++
solr/core/src/java/org/apache/solr/util/SolrCLI.java | 7 ++-----
solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java | 6 ++++++
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d5cfe7d0359..ca00dacb38d 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -279,6 +279,8 @@ Other Changes
* SOLR-15928: Dim 'Add Collection' and 'Create Alias' buttons when user lacks proper permissions (janhoy)
+* SOLR-16672: Simplify SolrCLI Healthcheck command's logic for obtaining a target collection (Eric Pugh)
+
================== 9.1.1 ==================
Bug Fixes
diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
index c7112bf6608..546a0f50bca 100755
--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
@@ -211,9 +211,6 @@ public class SolrCLI implements CLIO {
new CloudLegacySolrClient.Builder(Collections.singletonList(zkHost), Optional.empty())
.build()) {
- String collection = cli.getOptionValue("collection");
- if (collection != null) cloudSolrClient.setDefaultCollection(collection);
-
cloudSolrClient.connect();
runCloudTool(cloudSolrClient, cli);
}
@@ -592,7 +589,7 @@ public class SolrCLI implements CLIO {
* Tries a simple HEAD request and throws SolrException in case of Authorization error
*
* @param url the url to do a HEAD request to
- * @param httpClient the http client to use (make sure it has authentication optinos set)
+ * @param httpClient the http client to use (make sure it has authentication options set)
* @return the HTTP response code
* @throws SolrException if auth/autz problems
* @throws IOException if connection failure
@@ -1273,7 +1270,7 @@ public class SolrCLI implements CLIO {
SolrQuery q = new SolrQuery("*:*");
q.setRows(0);
- QueryResponse qr = cloudSolrClient.query(q);
+ QueryResponse qr = cloudSolrClient.query(collection, q);
String collErr = null;
long docCount = -1;
try {
diff --git a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java
index 320c0000d10..855e85e0c54 100644
--- a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java
+++ b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java
@@ -324,6 +324,12 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
testExample("schemaless");
}
+ @Test
+ @LuceneTestCase.Nightly
+ public void testFilmsExample() throws Exception {
+ testExample("films");
+ }
+
protected void testExample(String exampleName) throws Exception {
File solrHomeDir = new File(ExternalPaths.SERVER_HOME);
if (!solrHomeDir.isDirectory())