Scripts to commit, optimize or delete on a solr index
authorDennis Schafroth <dennis@indexdata.com>
Wed, 24 Apr 2013 11:32:19 +0000 (13:32 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 24 Apr 2013 11:32:19 +0000 (13:32 +0200)
commit_solr.sh [new file with mode: 0644]
delete_solr.sh [new file with mode: 0755]
optimize_solr.sh [new file with mode: 0755]

diff --git a/commit_solr.sh b/commit_solr.sh
new file mode 100644 (file)
index 0000000..0cb3a43
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [ "$1" == "" ] ; then 
+    echo "No database id given"
+    exit 1 ; 
+fi  
+HOST=localhost
+PORT=8080
+curl http://$HOST:$PORT/solr/update -H "Content-Type: text/xml" --data-binary '<commit waitFlush="false" waitSearcher="false"/>'
\ No newline at end of file
diff --git a/delete_solr.sh b/delete_solr.sh
new file mode 100755 (executable)
index 0000000..8a586ae
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ "$1" == "" ] ; then 
+    echo "No database id given"
+    exit 1 ; 
+fi  
+HOST=localhost
+PORT=8080
+curl http://$HOST:$PORT/solr/update -H "Content-Type: text/xml" --data-binary "<delete><query>database:$1</query></delete>"
+curl http://$HOST:$PORT/solr/update -H "Content-Type: text/xml" --data-binary '<commit waitFlush="false" waitSearcher="false"/>'
\ No newline at end of file
diff --git a/optimize_solr.sh b/optimize_solr.sh
new file mode 100755 (executable)
index 0000000..90d9a26
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [ "$1" != "YES" ] ; then 
+    echo "No confirmation given"
+    exit 1 ; 
+fi  
+HOST=localhost
+PORT=8080
+curl http://$HOST:$PORT/solr/update -H "Content-Type: text/xml" --data-binary '<optimize waitSearcher="false" />'
\ No newline at end of file