lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cassandra Targett (Confluence)" <>
Subject [CONF] Apache Solr Reference Guide > Simple Posting Tool
Date Wed, 18 Sep 2013 15:44:00 GMT
Space: Apache Solr Reference Guide (
Page: Simple Posting Tool (

Added by Cassandra Targett:
Solr includes a simple command line tool for POSTing raw XML to a Solr port. XML data can
be read from files specified as command line arguments, as raw commandline argument strings,
or via STDIN.

The tool is called {{post.jar}} and is found in the 'exampledocs' directory: {{$SOLR/example/exampledocs/post.jar}}
includes a cross-platform Java tool for POST-ing XML documents. 

To run it, open a window and enter:

java -jar post.jar <list of files with  messages>

By default, this will contact the server at {{localhost:8983}}. The "-help" option will output
information on its usage ({{java -jar post.jar -help}}. 

h2. Using SimplePostTool

Options controlled by System Properties include the Solr URL to post to, the {{Content-Type}}
of the data, whether a commit or optimize should be executed, and whether the response should
be written to {{STDOUT}}.  If {{auto=yes}} the tool will try to guess the type and set {{Content-Type}}
and the URL automatically. When posting rich documents the file name will be propagated as
{{}} and also used as {{}}. You may override these or any other request
parameter through the {{\-Dparams}} property

Supported System Properties and their defaults:

|| Parameter || Values || Default ||
| \-Ddata | yes, no | default=files |
| \-Dtype | <content-type> | default=application/xml |
| \-Durl | <solr-update-url> | default=[http://localhost:8983/solr/update] |
| \-Dauto | yes, no | default=no |
| \-Drecursive | yes, no | default=no |
| \-Dfiletypes | <type>\[,<type>,..\] | default=xml, json, csv, pdf, doc, docx,
ppt, pptx, xls, xlsx, odt, odp, ods, rtf, htm, html |
| \-Dparams | "<key>=<value>\[&<key>=<value>...\]" | values must
be URL-encoded |
| \-Dcommit | yes, no | default=yes |
| \-Doptimize | yes, no | default=no |
| \-Dout | yes,no | default=no |


  java -jar post.jar *.xml
  java -Ddata=args  -jar post.jar '<delete><id>42</id></delete>'
  java -Ddata=stdin -jar post.jar < hd.xml
  java -Dtype=text/csv -jar post.jar *.csv
  java -Dtype=application/json -jar post.jar *.json
  java -Durl=[http://localhost:8983/solr/update/extract]
    -Dtype=application/pdf -jar post.jar a.pdf
  java -Dauto=yes -jar post.jar a.pdf
  java -Dauto=yes -Drecursive=yes -jar post.jar afolder
  java -Dauto=yes -Dfiletypes=ppt,html -jar post.jar afolder


In the above example:

| *\-Dauto=yes* | Will guess file type from file name suffix, and set type and url accordingly.
It also sets the ID and file name automatically. |
| *\-Drecursive=yes* | Will recurse into sub-folders and index all files. |
| *\-Dfiletypes* | Specifies the file types to consider when indexing folders. |
| *\-Dparams* | HTTP GET params to add to the request, so you don't need to write the whole
URL again. |


Stop watching space:
Change email notification preferences:

View raw message