You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2014/12/30 04:34:20 UTC

svn commit: r1648478 - in /lucene/dev/trunk/solr: CHANGES.txt bin/post

Author: ehatcher
Date: Tue Dec 30 03:34:19 2014
New Revision: 1648478

URL: http://svn.apache.org/r1648478
Log:
SOLR-6435: bin/post cleanup for 5x merge

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/bin/post

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1648478&r1=1648477&r2=1648478&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Dec 30 03:34:19 2014
@@ -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
 ----------------------

Modified: lucene/dev/trunk/solr/bin/post
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/post?rev=1648478&r1=1648477&r2=1648478&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/post (original)
+++ lucene/dev/trunk/solr/bin/post Tue Dec 30 03:34:19 2014
@@ -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 code
 SPT_JAR=dist/solr-core-*.jar
 
 COLLECTION=$1; shift
 
-echo "Collection: " $COLLECTION
+echo "Collection:" $COLLECTION
 
 PROPS="-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* ]]; then
   echo "WEB"
   PROPS="$PROPS -Ddata=web"
   PARAMS=$1; shift
 else
-  echo "PATH"
   if [[ -d $1 ]]; then
     # Directory
+    echo "DIRECTORY"
     PROPS="$PROPS -Ddata=files -Dauto -Drecursive"
     PARAMS=$1; shift
   else
     # Not a URL or existing directory, assume file(s)
+    echo "FILE"
     FILE=$1; shift
     EXTENSION="${FILE##*.}"
 
@@ -65,10 +86,11 @@ else
   fi
 fi
 
+# Add all additonal trailing script parameters as system properties to SPT (eg. bin/post core_name ~/Documents depth=1)
 while [ $# -gt 0 ]; do
   PROPS="$PROPS -D$1"
   shift
 done
 
-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