Fix PATH overriding
[lui-solr.git] / scripts / delete_solr.sh
index 2b91d65..6c51408 100755 (executable)
@@ -1,14 +1,20 @@
 #!/bin/bash
 
-if [ "$1" == "" ] ; then 
-    echo "$0 databaseid [HOST:PORT] "
-    exit 1 ; 
-fi  
-HOSTPORT="localhost:8080"
+HOST_PORT="localhost:8080"
 
 if [ "$2" != "" ] ; then 
-    HOSTPORT="$2"
+    HOST_PORT="$2"
 fi 
 
-curl http://${HOSTPORT}/solr/update -H "Content-Type: text/xml" --data-binary "<delete><query>database:$1</query></delete>"
-curl http://${HOSTPORT}/solr/update -H "Content-Type: text/xml" --data-binary '<commit waitFlush="false" waitSearcher="false"/>'
+SOLR_PATH=solr4
+if [ "$3" != "" ] ; then 
+    SOLR_PATH="$3"
+fi
+
+if [ "$1" == "" ] ; then 
+    echo "$0 databaseid [[HOST:PORT] PATH] (default $HOST_PORT/$PATH)"
+    exit 1 ; 
+fi  
+
+curl http://${HOST_PORT}/$SOLR_PATH/update -H "Content-Type: text/xml" --data-binary "<delete><query>database:$1</query></delete>"
+curl http://${HOST_PORT}/$SOLR_PATH/update -H "Content-Type: text/xml" --data-binary '<commit waitFlush="false" waitSearcher="false"/>'