Apache Solr open-source search software
SOLR-6435: bin/post cleanup for 5x merge
Erik Hatcher119d8caa21d2
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 2da6b62c3c9..1d6e0f04911 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -47,7 +47,6 @@ Other Changes* SOLR-6127: Improve example docs, using films data (Varun Thacker via ehatcher)-* SOLR-6435: Add bin/post script to simplify posting content to Solr (ehatcher)================== 5.0.0 ==================@@ -261,6 +260,8 @@ New Features* SOLR-6879: Have an option to disable autoAddReplicas temporarily for all collections.(Varun Thacker via Steve Rowe)+* SOLR-6435: Add bin/post script to simplify posting content to Solr (ehatcher)+Bug Fixes----------------------diff --git a/solr/bin/post b/solr/bin/postindex d1247ea735f..1ad69993a23 100755--- a/solr/bin/post+++ b/solr/bin/post@@ -22,29 +22,50 @@# bin/post records article*.xml# bin/post wizbang events.json+# ====== Common code copied from bin/solr (TODO: centralize/share this kind of thing)+if [ -n "$SOLR_JAVA_HOME" ]; then+ JAVA=$SOLR_JAVA_HOME/bin/java+elif [ -n "$JAVA_HOME" ]; then+ for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do+ if [ -x "$java" ]; then+ JAVA="$java"+ break+ fi+ done+else+ JAVA=java+fi++# test that Java exists and is executable on this server+$JAVA -version >/dev/null 2>&1 || { echo >&2 "Java is required to run this tool! Please install Java 8 or greater before running this script."; exit 1; }+++# ===== post specific codeSPT_JAR=dist/solr-core-*.jarCOLLECTION=$1; shift-echo "Collection: " $COLLECTION+echo "Collection:" $COLLECTIONPROPS="-Dc=$COLLECTION"PARAMS=""# TODO: Check that $COLLECTION actually exists? How to determine if user omitted collection name as first param?+echo -n "Data mode: "if [[ $1 == http* ]]; thenecho "WEB"PROPS="$PROPS -Ddata=web"PARAMS=$1; shiftelse- echo "PATH"if [[ -d $1 ]]; then# Directory+ echo "DIRECTORY"PROPS="$PROPS -Ddata=files -Dauto -Drecursive"PARAMS=$1; shiftelse# Not a URL or existing directory, assume file(s)+ echo "FILE"FILE=$1; shiftEXTENSION="${FILE##*.}"@@ -65,10 +86,11 @@ elsefifi+# Add all additonal trailing script parameters as system properties to SPT (eg. bin/post core_name ~/Documents depth=1)while [ $# -gt 0 ]; doPROPS="$PROPS -D$1"shiftdone-echo java -classpath $SPT_JAR $PROPS org.apache.solr.util.SimplePostTool $PARAMS-java -classpath $SPT_JAR $PROPS org.apache.solr.util.SimplePostTool $PARAMS+echo $JAVA -classpath $SPT_JAR $PROPS org.apache.solr.util.SimplePostTool $PARAMS+$JAVA -classpath $SPT_JAR $PROPS org.apache.solr.util.SimplePostTool $PARAMS