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/07/31 19:14:40 UTC

[solr] 02/02: Finish backporting SOLR-16803.

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

commit 7293ad6d0c1518fbe2ab25d3b159d93940c5867e
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Mon Jul 31 15:14:25 2023 -0400

    Finish backporting SOLR-16803.
---
 .../java/org/apache/solr/cli/RunExampleTool.java   | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
index 44b851a4599..a3615ef92c4 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -390,20 +390,14 @@ public class RunExampleTool extends ToolBase {
         File filmsJsonFile = new File(exampleDir, "films/films.json");
         String updateUrl = String.format(Locale.ROOT, "%s/%s/update/json", solrUrl, collectionName);
         echo("Indexing films example docs from " + filmsJsonFile.getAbsolutePath());
-        String[] args =
-            new String[] {
-              "post",
-              "-commit",
-              "-url",
-              updateUrl,
-              "-type",
-              "application/json",
-              exampleDir.toString()
-            };
-        PostTool postTool = new PostTool();
-        CommandLine postToolCli =
-            SolrCLI.parseCmdLine(postTool.getName(), args, postTool.getOptions());
-        postTool.runTool(postToolCli);
+        String currentPropVal = System.getProperty("url");
+        System.setProperty("url", updateUrl);
+        SimplePostTool.main(new String[] {filmsJsonFile.getAbsolutePath()});
+        if (currentPropVal != null) {
+          System.setProperty("url", currentPropVal); // reset
+        } else {
+          System.clearProperty("url");
+        }
 
       } catch (Exception ex) {
         throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, ex);