Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC49110C22 for ; Wed, 18 Sep 2013 17:10:02 +0000 (UTC) Received: (qmail 60902 invoked by uid 500); 18 Sep 2013 17:10:01 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 60887 invoked by uid 99); 18 Sep 2013 17:10:01 -0000 Received: from cwiki-vm.apache.org (HELO cwiki-vm) (140.211.11.69) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Sep 2013 17:10:01 +0000 Received: from cwiki-vm (localhost [127.0.0.1]) by cwiki-vm (Postfix) with ESMTP id 870EBA2632 for ; Wed, 18 Sep 2013 17:10:00 +0000 (UTC) Date: Wed, 18 Sep 2013 17:10:00 +0000 (UTC) From: "Cassandra Targett (Confluence)" To: commits@lucene.apache.org Message-ID: <58940217.22154.1379524200026.JavaMail.confluence@cwiki-vm> Subject: [CONF] Apache Solr Reference Guide > Simple Post Tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Auto-Submitted: auto-generated Space: Apache Solr Reference Guide (https://cwiki.apache.org/confluence/display/solr) Page: Simple Post Tool (https://cwiki.apache.org/confluence/display/solr/Simple+Post+Tool) Change Comment: --------------------------------------------------------------------- Rename page; fix examples; add more info on system properties Edited 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: {code:language=none|borderStyle=solid|borderColor=#666666} java -jar post.jar {code} By default, this will contact the server at {{localhost:8983}}. The '-help' (or simply '-h' option will output information on its usage (i.e., {{java -jar post.jar -help}}. h2. Using the Simple Post Tool 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}}. You may override any other request parameter through the {{\-Dparams}} property This table lists the supported system properties and their defaults: || Parameter || Values || Default || Description || | \-Ddata | args, stdin, files, web | files | Use *args* to pass arguments along the command line (such as a command to delete a document). Use *files* to pass a filename or regex pattern indicating paths and filenames. Use *stdin* to use standard input. Use *web* for a very simple web crawler (arguments for this would be the URL to crawl). | | \-Dtype | | application/xml | Defines the content-type, if {{-Dauto}} is not used. | | \-Durl | | http://localhost:8983/solr/update | The Solr URL to send the updates to. | | \-Dauto | yes, no | no | If yes, the tool will guess the file type from file name suffix, and set type and url accordingly. It also sets the ID and file name automatically. | | \-Drecursive | yes, no | no | Will recurse into sub-folders and index all files. | | \-Dfiletypes | \[,,..\] | xml, json, csv, pdf, doc, docx, ppt, pptx, xls, xlsx, odt, odp, ods, rtf, htm, html | Specifies the file types to consider when indexing folders. | | \-Dparams | "=\[&=...\]" | none | HTTP GET params to add to the request, so you don't need to write the whole URL again. Values must be URL-encoded. | | \-Dcommit | yes, no | yes | Perform a commit after adding the documents. | | \-Doptimize | yes, no | no | Perform an optimize after adding the documents. | | \-Dout | yes, no | no | Write the response to an output file. | h3. Examples There are several ways to use {{post.jar}}. Here are a few examples: Add all documents with file extension {{.xml}}. {code:language=none|borderStyle=solid|borderColor=#666666} java -jar post.jar *.xml {code} Send XML arguments to delete a document from the index. {code:language=none|borderStyle=solid|borderColor=#666666} java -Ddata=args -jar post.jar '42' {code} Index all CSV files. {code:language=none|borderStyle=solid|borderColor=#666666} java -Dtype=text/csv -jar post.jar *.csv {code} Index all JSON files. {code:language=none|borderStyle=solid|borderColor=#666666} java -Dtype=application/json -jar post.jar *.json {code} Use the [extracting request handler|solr:Uploading Data with Solr Cell using Apache Tika] to index a PDF file. {code:language=none|borderStyle=solid|borderColor=#666666} java -Durl=[http://localhost:8983/solr/update/extract] -Dparams=literal.id=a -Dtype=application/pdf -jar post.jar a.pdf {code} Automatically detect the content type based on the file extension. {code:language=none|borderStyle=solid|borderColor=#666666} java -Dauto=yes -jar post.jar a.pdf {code} Automatically detect content types in a folder, and recursively scan it for documents. {code:language=none|borderStyle=solid|borderColor=#666666} java -Dauto=yes -Drecursive=yes -jar post.jar afolder {code} Automatically detect content types in a folder, but limit it to PPT and HTML files. {code:language=none|borderStyle=solid|borderColor=#666666} java -Dauto=yes -Dfiletypes=ppt,html -jar post.jar afolder {code} {scrollbar} Stop watching space: https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=solr Change email notification preferences: https://cwiki.apache.org/confluence/users/editmyemailsettings.action