Peer-reviewed code snippets that anyone can edit
follow refactory on twitter
blog
feedback
A wiki for useful code snippets
Bugs? Suggestions?
38-107-191-111
create/login
options
RECENT
STUBS/REQUESTS
STARRED
ACTIVITY
ADD
VIEW
EDIT
HISTORY
FORK
Command-line interface to the Apache Solr REST API
bash
solr
utility
Your work won't be attributed to you
because you aren't logged in.
Login using OpenID or an existing username, or create a username
(no email required) before posting.
Languages
Comma separated. Like
ruby, rails
or
java, swing
Keywords
Comma separated. Like
file, network
Mark as stub
Snippet
Wrap code in
[code=
language
][/code]
- Use
WikiText markup
outside of [code] tags
+++ Solr Tool A convenient command-line interface to Apache Solr, built around curl. Requires [http://xmlsoft.org/xmllint.html xmllint] - for pretty-printing the output. Requires [http://pygments.org Pygments] - for syntax-highlighting the output. **Usage:** {{solr BASE RESOURCE <ARGS>}} : {{BASE}} : is either the http:// base of a solr instance, or one of the known shortcuts in the case statement. : {{RESOURCE}} : is added as {{$BASE/$RESOURCE}} for a full REST URL. Remaining ARGS are passed to curl. Use {{-F key=value}} to POST form parameters. +++ Examples [code=bash] 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 [/code] [code=bash] #!/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 [/code]
Log message
Human?
public snippets
This is a community-maintained collection of reusable code snippets.
Contribute something
without logging in, or improve existing contributions. All code is dedicated to the public domain unless otherwise specified.
stats
/
top contributers