Skip to content

Commit

Permalink
SOLR-17595: Backport "Fix Solr examples for Windows" (#2911)
Browse files Browse the repository at this point in the history
* Fix argument parsing for -D options with multiple values on Windows

(cherry picked from commit 44ea44d)

* SOLR-17595: Fix Solr examples for Windows (#2909)

* Fix argument parsing for -D options with multiple values on Windows

* Fix invalid usage of wildcards in RunExampleTool / PostTool

(cherry picked from commit a4229e7)

* Fix unsupported method
  • Loading branch information
malliaridis committed Dec 18, 2024
1 parent 920928b commit a86d50d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
3 changes: 3 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ Bug Fixes

* SOLR-17586: Print zkcli.sh deprecation msg to stderr, which fixes Solr Operator upload of security.json to zookeeper (Jan Høydahl)

* SOLR-17595: Fix two issues in Solr CLI that prevent Solr from starting with the techproducts example and from
correctly parsing arguments on Windows that start with -D and have multiple values separated by "," or spaces. (Christos Malliaridis)

Dependency Upgrades
---------------------
* PR#2702: chore(deps): update io.netty:* to v4.1.114.final (solrbot)
Expand Down
27 changes: 24 additions & 3 deletions solr/bin/solr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -726,15 +726,36 @@ SHIFT
goto parse_args

:set_passthru
set "PASSTHRU=%~1=%~2"
set "PASSTHRU_KEY=%~1"
set "PASSTHRU_VALUES="

SHIFT
:repeat_passthru
set "arg=%~1"
if "%arg%"=="" goto end_passthru
set firstChar=%arg:~0,1%
IF "%firstChar%"=="-" (
goto end_passthru
)

if defined PASSTHRU_VALUES (
set "PASSTHRU_VALUES=%PASSTHRU_VALUES%,%arg%"
) else (
set "PASSTHRU_VALUES=%arg%"
)
SHIFT
goto repeat_passthru

:end_passthru
set "PASSTHRU=%PASSTHRU_KEY%=%PASSTHRU_VALUES%"

IF NOT "%SOLR_OPTS%"=="" (
set "SOLR_OPTS=%SOLR_OPTS% %PASSTHRU%"
) ELSE (
set "SOLR_OPTS=%PASSTHRU%"
)
set "PASS_TO_RUN_EXAMPLE=%PASSTHRU% !PASS_TO_RUN_EXAMPLE!"
SHIFT
SHIFT

goto parse_args

:set_noprompt
Expand Down
4 changes: 3 additions & 1 deletion solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ protected void runExample(CommandLine cli, String exampleName) throws Exception
collectionName,
"--type",
"application/xml",
exampledocsDir.getAbsolutePath() + "/*.xml"
"--filetypes",
"xml",
exampledocsDir.getAbsolutePath()
};
PostTool postTool = new PostTool();
CommandLine postToolCli = SolrCLI.parseCmdLine(postTool, args);
Expand Down

0 comments on commit a86d50d

Please sign in to comment.