A convenient command-line interface to Apache Solr, built around curl.
Requires xmllint - for pretty-printing the output. Requires Pygments - for syntax-highlighting the output.
Usage: solr BASE RESOURCE <ARGS>
one of the known shortcuts in the case statement.
Remaining ARGS are passed to curl. Use -F key=value to POST form parameters.
solr local dataimport -F command=delta-import solr local 'core0/select?q=solr' solr http://localhost:8983/solr admin/cores -F command=RELOAD -F core=core0 solr local
#!/bin/bash BASE="$1"; shift RESOURCE="$1"; shift case $BASE in dev) URL=http://eridanus.mihinternet.com:8983/solr ;; local) URL=http://localhost:8983/solr ;; http*) URL="$BASE" ;; esac [ -z $URL ] && { echo "No base URL specified."; exit 1; } [ -z $RESOURCE ] && { echo "No resource specified."; exit 1; } curl -s $URL/$RESOURCE "$@" | xmllint --format - | pygmentize -l xml -f console