janhoy commented on code in PR #4269:
URL: https://github.com/apache/solr/pull/4269#discussion_r3045019959
##########
solr/core/src/java/org/apache/solr/cli/CreateTool.java:
##########
@@ -123,45 +183,45 @@ public Options getOptions() {
@Override
public void runImpl(CommandLine cli) throws Exception {
try (var solrClient = CLIUtils.getSolrClient(cli)) {
+ CreateParams params =
+ new CreateParams(
+ cli.getOptionValue(COLLECTION_NAME_OPTION),
+ cli.getOptionValue(CONF_DIR_OPTION,
DefaultValues.DEFAULT_CONFIG_SET),
+ cli.getOptionValue(CONF_NAME_OPTION),
+ cli.getOptionValue(CommonCLIOptions.SOLR_URL_OPTION,
CLIUtils.getDefaultSolrUrl()),
+ cli.getOptionValue(CommonCLIOptions.CREDENTIALS_OPTION),
+ cli.getParsedOptionValue(SHARDS_OPTION, 1),
+ cli.getParsedOptionValue(REPLICATION_FACTOR_OPTION, 1));
if (CLIUtils.isCloudMode(solrClient)) {
- createCollection(cli);
+ createCollection(CLIUtils.getZkHost(cli), params);
} else {
- createCore(cli, solrClient);
+ createCore(params, solrClient);
}
}
}
- protected void createCore(CommandLine cli, SolrClient solrClient) throws
Exception {
- String coreName = cli.getOptionValue(COLLECTION_NAME_OPTION);
- String solrUrl =
- cli.getOptionValue(CommonCLIOptions.SOLR_URL_OPTION,
CLIUtils.getDefaultSolrUrl());
-
- final String solrInstallDir = System.getProperty("solr.install.dir");
- final String confDirName =
- cli.getOptionValue(CONF_DIR_OPTION, DefaultValues.DEFAULT_CONFIG_SET);
-
+ private void createCore(CreateParams params, SolrClient solrClient) throws
Exception {
// we allow them to pass a directory instead of a configset name
- Path configsetDir = Path.of(confDirName);
- Path solrInstallDirPath = Path.of(solrInstallDir);
+ Path configsetDir = Path.of(params.confDir);
+ Path solrInstallDirPath = Path.of(System.getProperty("solr.install.dir"));
Review Comment:
Invalid claim by Copilot
##########
solr/core/src/java/org/apache/solr/cli/DeleteTool.java:
##########
@@ -93,31 +131,34 @@ public Options getOptions() {
@Override
public void runImpl(CommandLine cli) throws Exception {
try (var solrClient = CLIUtils.getSolrClient(cli)) {
+ DeleteParams params =
+ new DeleteParams(
+ cli.getOptionValue(COLLECTION_NAME_OPTION),
+ cli.getOptionValue(CommonCLIOptions.CREDENTIALS_OPTION),
+ cli.hasOption(DELETE_CONFIG_OPTION),
+ cli.hasOption(FORCE_OPTION));
if (CLIUtils.isCloudMode(solrClient)) {
- deleteCollection(cli);
+ deleteCollection(CLIUtils.getZkHost(cli), params);
} else {
- deleteCore(cli, solrClient);
+ deleteCore(params, solrClient);
}
}
}
- protected void deleteCollection(CommandLine cli) throws Exception {
+ private void deleteCollection(String zkHost, DeleteParams params) throws
Exception {
var builder =
new HttpJettySolrClient.Builder()
.withIdleTimeout(30, TimeUnit.SECONDS)
.withConnectionTimeout(15, TimeUnit.SECONDS)
.withKeyStoreReloadInterval(-1, TimeUnit.SECONDS)
- .withOptionalBasicAuthCredentials(
- cli.getOptionValue(CommonCLIOptions.CREDENTIALS_OPTION));
-
- String zkHost = CLIUtils.getZkHost(cli);
+ .withOptionalBasicAuthCredentials(params.credentials);
Review Comment:
Invalid claim by Copilot
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]