You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2015/08/26 14:33:11 UTC
svn commit: r1697904 - in /lucene/dev/trunk/solr: CHANGES.txt bin/solr
bin/solr.cmd core/src/java/org/apache/solr/util/SolrCLI.java
Author: janhoy
Date: Wed Aug 26 12:33:10 2015
New Revision: 1697904
URL: http://svn.apache.org/r1697904
Log:
SOLR-7961: Add version command to bin/solr start script. Also adds -h for help
Modified:
lucene/dev/trunk/solr/CHANGES.txt
lucene/dev/trunk/solr/bin/solr
lucene/dev/trunk/solr/bin/solr.cmd
lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java
Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1697904&r1=1697903&r2=1697904&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Aug 26 12:33:10 2015
@@ -127,6 +127,7 @@ New Features
to refer to a single-sharded collection that has a replica on all nodes where there is a
replica in the to index (Andrei Beliakov via Mikhail Khludnev)
+* SOLR-7961: Print Solr's version with command bin/solr version (janhoy)
Bug Fixes
----------------------
@@ -200,6 +201,8 @@ Other Changes
* SOLR-7007: DistributedUpdateProcessor now logs replay flag as boolean instead of int
(Mike Drob via Christine Poerschke)
+* SOLR-7960: Start scripts now gives generic help for bin/solr -h and bin/solr --help (janhoy)
+
================== 5.3.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
Modified: lucene/dev/trunk/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/solr?rev=1697904&r1=1697903&r2=1697904&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/solr (original)
+++ lucene/dev/trunk/solr/bin/solr Wed Aug 26 12:33:10 2015
@@ -188,7 +188,7 @@ function print_usage() {
if [ -z "$CMD" ]; then
echo ""
echo "Usage: solr COMMAND OPTIONS"
- echo " where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete"
+ echo " where COMMAND is one of: start, stop, restart, status, healthcheck, create, create_core, create_collection, delete, version"
echo ""
echo " Standalone server example (start Solr running in the background on port 8984):"
echo ""
@@ -500,7 +500,7 @@ function stop_solr() {
if [ $# -eq 1 ]; then
case $1 in
- -help|-usage)
+ -help|-usage|-h|--help)
print_usage ""
exit
;;
@@ -508,6 +508,10 @@ if [ $# -eq 1 ]; then
get_info
exit
;;
+ -version|-v|version)
+ run_tool version
+ exit
+ ;;
esac
fi
Modified: lucene/dev/trunk/solr/bin/solr.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/solr.cmd?rev=1697904&r1=1697903&r2=1697904&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/solr.cmd (original)
+++ lucene/dev/trunk/solr/bin/solr.cmd Wed Aug 26 12:33:10 2015
@@ -94,10 +94,15 @@ IF [%1]==[] goto usage
IF "%1"=="-help" goto usage
IF "%1"=="-usage" goto usage
+IF "%1"=="-h" goto usage
+IF "%1"=="--help" goto usage
IF "%1"=="/?" goto usage
IF "%1"=="-i" goto get_info
IF "%1"=="-info" goto get_info
IF "%1"=="status" goto get_info
+IF "%1"=="version" goto get_version
+IF "%1"=="-v" goto get_version
+IF "%1"=="-version" goto get_version
REM Only allow the command to be the first argument, assume start if not supplied
IF "%1"=="start" goto set_script_cmd
@@ -136,6 +141,8 @@ IF NOT "%SCRIPT_ERROR%"=="" ECHO %SCRIPT
IF [%FIRST_ARG%]==[] goto script_usage
IF "%FIRST_ARG%"=="-help" goto script_usage
IF "%FIRST_ARG%"=="-usage" goto script_usage
+IF "%FIRST_ARG%"=="-h" goto script_usage
+IF "%FIRST_ARG%"=="--help" goto script_usage
IF "%FIRST_ARG%"=="/?" goto script_usage
IF "%SCRIPT_CMD%"=="start" goto start_usage
IF "%SCRIPT_CMD%"=="restart" goto start_usage
@@ -150,7 +157,7 @@ goto done
:script_usage
@echo.
@echo Usage: solr COMMAND OPTIONS
-@echo where COMMAND is one of: start, stop, restart, healthcheck, create, create_core, create_collection, delete
+@echo where COMMAND is one of: start, stop, restart, healthcheck, create, create_core, create_collection, delete, version
@echo.
@echo Standalone server example (start Solr running in the background on port 8984):
@echo.
@@ -968,6 +975,12 @@ IF NOT DEFINED HEALTHCHECK_ZK_HOST set "
org.apache.solr.util.SolrCLI healthcheck -collection !HEALTHCHECK_COLLECTION! -zkHost !HEALTHCHECK_ZK_HOST!
goto done
+:get_version
+"%JAVA%" %SOLR_SSL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+ org.apache.solr.util.SolrCLI version
+goto done
+
:parse_create_args
IF [%1]==[] goto run_create
IF "%1"=="-c" goto set_create_name
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1697904&r1=1697903&r2=1697904&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java Wed Aug 26 12:33:10 2015
@@ -70,6 +70,7 @@ import org.apache.http.client.utils.URIB
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
+import org.apache.lucene.util.Version;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
@@ -225,6 +226,12 @@ public class SolrCLI {
exit(1);
}
+ if (args.length == 1 && Arrays.asList("-v","-version","version").contains(args[0])) {
+ // Simple version tool, no need for its own class
+ System.out.println(Version.LATEST);
+ exit(0);
+ }
+
String configurerClassName = System.getProperty("solr.authentication.httpclient.configurer");
if (configurerClassName!=null) {
try {