This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 79877b35b3c SOLR-18169: Slim distribution no longer includes examples
(#5289)
79877b35b3c is described below
commit 79877b35b3c0db84a09018e94439c2164856961b
Author: Nick <[email protected]>
AuthorDate: Fri Nov 6 14:49:49 2026 -0700
SOLR-18169: Slim distribution no longer includes examples (#5289)
---
.../unreleased/solr-18169-slim-no-examples.yml | 8 ++
.../java/org/apache/solr/cli/RunExampleTool.java | 11 ++-
.../org/apache/solr/cli/TestSolrCLIRunExample.java | 101 +++++++++++++++++++++
solr/packaging/README.txt | 6 +-
solr/packaging/build.gradle | 8 +-
.../deployment-guide/pages/installing-solr.adoc | 2 +-
.../pages/tutorial-five-minutes.adoc | 8 +-
7 files changed, 132 insertions(+), 12 deletions(-)
diff --git a/changelog/unreleased/solr-18169-slim-no-examples.yml
b/changelog/unreleased/solr-18169-slim-no-examples.yml
new file mode 100644
index 00000000000..92dc7439788
--- /dev/null
+++ b/changelog/unreleased/solr-18169-slim-no-examples.yml
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: "Slim distributions no longer include examples"
+type: changed
+authors:
+ - name: Nick Shanin
+links:
+ - name: SOLR-18169
+ url: https://issues.apache.org/jira/browse/SOLR-18169
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 66828271c06..e40c7bd2366 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -576,11 +576,20 @@ public class RunExampleTool extends ToolBase {
exampleDir =
(exampleDirArg != null) ? Path.of(exampleDirArg) :
serverDir.getParent().resolve("example");
- if (!Files.isDirectory(exampleDir))
+ boolean exampleDirIsDirectory = Files.isDirectory(exampleDir);
+ if (!exampleDirIsDirectory && exampleDirArg != null) {
throw new IllegalArgumentException(
"Value of --example-dir option is invalid! "
+ exampleDir.toAbsolutePath()
+ " is not a directory!");
+ }
+ if (!exampleDirIsDirectory) {
+ throw new IllegalArgumentException(
+ "The default example directory does not exist or is not a directory.
"
+ + "This is expected when using the slim Solr distribution, which
does not include "
+ + "examples. Use the full Solr distribution to run examples, or
check that your "
+ + "full installation is complete.");
+ }
if (solrHomeArg != null) {
solrHomeDir = Path.of(solrHomeArg);
diff --git a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
index b9957e993cc..224c1b643ad 100644
--- a/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
+++ b/solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java
@@ -673,4 +673,105 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4
{
int code = runTool(tool, toolArgs);
assertEquals("Execution should have failed with return code 1", 1, code);
}
+
+ @Test
+ public void testMissingDefaultExampleDirectoryExplainsSlimDistribution()
throws Exception {
+ Path solrServerDir = createTestServerDir();
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () -> tool.initDirs(solrServerDir.toString(), null, null, null,
"techproducts"));
+
+ assertEquals(
+ "The default example directory does not exist or is not a directory. "
+ + "This is expected when using the slim Solr distribution, which
does not include "
+ + "examples. Use the full Solr distribution to run examples, or
check that your "
+ + "full installation is complete.",
+ exception.getMessage());
+ }
+
+ @Test
+ public void
testMissingDefaultExampleDirectoryExplainsSlimDistributionForFilms()
+ throws Exception {
+ Path solrServerDir = createTestServerDir();
+ String[] toolArgs =
+ new String[] {"--example", "films", "--server-dir",
solrServerDir.toString()};
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () -> tool.runImpl(SolrCLI.processCommandLineArgs(tool,
toolArgs)));
+
+ assertEquals(
+ "The default example directory does not exist or is not a directory. "
+ + "This is expected when using the slim Solr distribution, which
does not include "
+ + "examples. Use the full Solr distribution to run examples, or
check that your "
+ + "full installation is complete.",
+ exception.getMessage());
+ }
+
+ @Test
+ public void testExplicitMissingExampleDirectoryRemainsInvalid() throws
Exception {
+ Path solrServerDir = createTestServerDir();
+ Path missingExampleDir =
solrServerDir.getParent().resolve("custom-example");
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () ->
+ tool.initDirs(
+ solrServerDir.toString(),
+ null,
+ missingExampleDir.toString(),
+ null,
+ "techproducts"));
+
+ assertTrue(
+ exception.getMessage(),
+ exception.getMessage().startsWith("Value of --example-dir option is
invalid! "));
+
assertTrue(exception.getMessage().contains(missingExampleDir.toAbsolutePath().toString()));
+ }
+
+ @Test
+ public void testUnsupportedExampleWithExampleDirectoryPresent() throws
Exception {
+ Path solrServerDir = createTestServerDir();
+ Path exampleDir =
Files.createDirectory(solrServerDir.getParent().resolve("example"));
+ Path solrHomeDir = createTempDir();
+ String unsupportedExample = "not-an-example";
+ String[] toolArgs =
+ new String[] {
+ "--example", unsupportedExample,
+ "--server-dir", solrServerDir.toString(),
+ "--solr-home", solrHomeDir.toString()
+ };
+ RunExampleTool tool =
+ new RunExampleTool(null, System.in, new
CLITestHelper.TestingRuntime(false));
+
+ IllegalArgumentException exception =
+ expectThrows(
+ IllegalArgumentException.class,
+ () -> tool.runImpl(SolrCLI.processCommandLineArgs(tool,
toolArgs)));
+
+ assertEquals(
+ "Unsupported example "
+ + unsupportedExample
+ + "! Please choose one of: cloud, schemaless, techproducts, or
films",
+ exception.getMessage());
+ }
+
+ private Path createTestServerDir() throws IOException {
+ Path installDir = createTempDir();
+ Path serverDir = Files.createDirectory(installDir.resolve("server"));
+ Path solrScript = installDir.resolve("bin").resolve(CLIUtils.isWindows() ?
"solr.cmd" : "solr");
+ Files.createDirectories(solrScript.getParent());
+ Files.createFile(solrScript);
+ return serverDir;
+ }
}
diff --git a/solr/packaging/README.txt b/solr/packaging/README.txt
index b598a1ea48d..fe3cddfa896 100644
--- a/solr/packaging/README.txt
+++ b/solr/packaging/README.txt
@@ -33,8 +33,9 @@ To get started run
bin/solr --help
```
-Solr includes a few examples to help you get started. For instance, if you
want
-to run the techproducts example, enter:
+The full Solr distribution includes a few examples to help you get started.
+Examples are not included in the "slim" release. To run the techproducts
example
+from the full distribution, enter:
```
bin/solr start -e techproducts
@@ -68,6 +69,7 @@ cross-dc-manager/
A standalone application, included under `bin/`, that manages
Cross-Datacenter indexing across SolrClouds.
example/
+ (Not included in the "slim" release)
Contains example documents and an alternative Solr home
directory containing various examples.
diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle
index 23cfa089997..1c535e86d99 100644
--- a/solr/packaging/build.gradle
+++ b/solr/packaging/build.gradle
@@ -102,10 +102,6 @@ distributions {
into 'lib'
})
- from(configurations.example, {
- into "example"
- })
-
from(configurations.server, {
into "server"
})
@@ -136,6 +132,10 @@ distributions {
// Build on-top of the slim distribution
with(distributions.slim.getContents())
+ from(configurations.example, {
+ into "example"
+ })
+
from(configurations.modules, {
into "modules"
})
diff --git
a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc
b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc
index 61f90aaa7e2..f48380e641a 100644
--- a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc
+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc
@@ -31,7 +31,7 @@ Download the latest release
https://solr.apache.org/downloads.html.
There are three separate packages:
* `solr-{solr-full-version}.tgz` the full binary package, for all operating
systems. This package includes all first-party Solr modules and accessories.
-* `solr-{solr-full-version}-slim.tgz` the slim binary package, for all
operating systems. This package only includes what is necessary to run Solr.
Modules and accessories are not included.
+* `solr-{solr-full-version}-slim.tgz` the slim binary package, for all
operating systems. This package only includes what is necessary to run Solr.
Modules, accessories, and bundled examples are not included; use the full
package to run the bundled examples.
* `solr-{solr-full-version}-src.tgz` the package Solr source code.
This is useful if you want to develop on Solr without using the official Git
repository.
diff --git
a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc
b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc
index b24031a6af2..68d6b7062fc 100644
---
a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc
+++
b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc
@@ -23,13 +23,13 @@ This exercise will walk you through how to start using Solr
in just 5 Minutes!
[source,bash,subs="attributes"]
----
-curl -fsSL
https://dlcdn.apache.org/solr/solr/{solr-full-version}/solr-{solr-full-version}-slim.tgz
-o solr-{solr-full-version}-slim.tgz && \
-tar -xzf solr-{solr-full-version}-slim.tgz && \
-cd solr-{solr-full-version}-slim && \
+curl -fsSL
https://dlcdn.apache.org/solr/solr/{solr-full-version}/solr-{solr-full-version}.tgz
-o solr-{solr-full-version}.tgz && \
+tar -xzf solr-{solr-full-version}.tgz && \
+cd solr-{solr-full-version} && \
bin/solr start
----
-On Windows download and unpack into a temp directory. Start with `bin\solr
start`.
+On Windows download and into a temp directory. Start with `bin\solr start`.
== Create a collection