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 2015/01/06 21:29:57 UTC

svn commit: r1649940 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/bin/ solr/bin/post

Author: ehatcher
Date: Tue Jan  6 20:29:57 2015
New Revision: 1649940

URL: http://svn.apache.org/r1649940
Log:
SOLR-6900: added usage to bin/post, plus some TODOs (merged from trunk r1649937)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/post

Modified: lucene/dev/branches/branch_5x/solr/bin/post
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/post?rev=1649940&r1=1649939&r2=1649940&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/post (original)
+++ lucene/dev/branches/branch_5x/solr/bin/post Tue Jan  6 20:29:57 2015
@@ -22,6 +22,8 @@
 #  bin/post records article*.xml
 #  bin/post wizbang events.json
 
+# TODO: handle stdin as well, such that `cat foo.csv | bin/post my_collection` works
+
 # ====== 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
@@ -41,17 +43,36 @@ $JAVA -version >/dev/null 2>&1 || { echo
 
 
 # ===== post specific code
-SPT_JAR=dist/solr-core-*.jar
+
+function print_usage() {
+  echo ""
+  echo "Usage: post <collection/core> <file|directory|url> [OPTIONS]"
+  echo "    or post -help"
+  echo ""
+} # end print_usage
+
+if [[ $# -eq 1 && ("$1" == "-help" || "$1" == "-h" || "$1" == "-usage") ]]; then
+  print_usage
+  exit
+fi
+
+
+TOOL_JAR=dist/solr-core-*.jar
 
 COLLECTION=$1; shift
 
+# TODO: fix globbing issues... bin/post collection *.xml doens't work as expected (only first file indexed?)
+# TODO: fix bin/post *.xml issues, where collection isn't specified, so it assumes first passed file name is collection name
+
+# TODO: Check that $COLLECTION actually exists?   How to determine if user omitted collection name as first param?
+# "$JAVA" -classpath "$TOOL_JAR" org.apache.solr.util.SolrCLI $* # except can't easily check for core existence with SolrCLI?
+# TODO: also need a more general way to set the URL (or just server or port) rather than passing url=... at the end.
+
 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"
@@ -92,5 +113,6 @@ while [ $# -gt 0 ]; do
   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 "$TOOL_JAR" $PROPS org.apache.solr.util.SimplePostTool $PARAMS
+$JAVA -classpath $TOOL_JAR $PROPS org.apache.solr.util.SimplePostTool $PARAMS
+