Skip to content

SOLR-18513: Port ExportTool to picocli - #5040

Merged
janhoy merged 6 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18513-picocli-export
Oct 8, 2026
Merged

janhoy merged 6 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18513-picocli-export

Conversation

@serhiy-bzhezytskyy

@serhiy-bzhezytskyy serhiy-bzhezytskyy commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18513

Description

Adds the picocli code path for bin/solr export, next to the commons-cli one.

Solution

ExportTool gets its annotated options and callTool() and is registered in SolrCLI; the commons-cli path is unchanged. As before, a connection target (--solr-url, --solr-connection or --zk-host) is mandatory; a missing one exits with picocli's usage-error code 2 instead of 1. Written with Claude Code.

Tests

ExportToolTest exports to jsonl and checks the file for the default and explicit --limit, --query, --fields and --format, and the missing-target failure; ExportToolPicocliTest runs it through picocli. check -x test is clean (rat skipped).

Checklist

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

Adds the picocli code path next to the commons-cli one, with tests that run the tool under both parsers and the generated reference page.
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests cat:cli labels Oct 6, 2026
picocli now lists and validates json, jsonl and javabin itself, so the help and the reference page show the choices and an unknown format is a usage error. The commons-cli path is unchanged.

@janhoy janhoy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small fix, then ok

Comment thread solr/core/src/java/org/apache/solr/cli/ExportTool.java
picocli now rejects a non-numeric --limit before the tool runs, with a usage error, instead of failing later in the number parsing. The commons-cli path is unchanged, and -1 still means all documents.
Comment thread changelog/unreleased/SOLR-18513-picocli-export.yml Outdated
serhiy-bzhezytskyy and others added 3 commits October 7, 2026 15:43
No picocli feature has been released yet, so a new command is a detail of the SOLR-17697 entry. Its author and JIRA are added there instead of a separate entry.
…export

# Conflicts:
#	changelog/unreleased/SOLR-17697-picocli-experimental-cli.yml
#	solr/core/src/java/org/apache/solr/cli/SolrCLI.java
@janhoy janhoy added this to the 10.x milestone Oct 8, 2026
@janhoy
janhoy merged commit 162db9e into apache:main Oct 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:cli documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants