org.apache.solr.util
Class SimplePostTool

java.lang.Object
  extended by org.apache.solr.util.SimplePostTool

public class SimplePostTool
extends java.lang.Object

A simple utility class for posting raw updates to a Solr server, has a main method so it can be run on the command line.


Field Summary
static java.lang.String DEFAULT_POST_URL
           
static java.lang.String POST_ENCODING
           
protected  java.net.URL solrUrl
           
static java.lang.String VERSION_OF_THIS_TOOL
           
 
Constructor Summary
SimplePostTool(java.net.URL solrUrl)
          Constructs an instance for posting data to the specified Solr URL (ie: "http://localhost:8983/solr/update")
 
Method Summary
 void commit(java.io.Writer output)
          Does a simple commit operation
static void main(java.lang.String[] args)
           
 void postData(java.io.Reader data, java.io.Writer output)
          Reads data from the data reader and posts it to solr, writes to the response to output
 void postFile(java.io.File file, java.io.Writer output)
          Opens the file and posts it's contents to the solrUrl, writes to response to output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POST_URL

public static final java.lang.String DEFAULT_POST_URL
See Also:
Constant Field Values

POST_ENCODING

public static final java.lang.String POST_ENCODING
See Also:
Constant Field Values

VERSION_OF_THIS_TOOL

public static final java.lang.String VERSION_OF_THIS_TOOL
See Also:
Constant Field Values

solrUrl

protected java.net.URL solrUrl
Constructor Detail

SimplePostTool

public SimplePostTool(java.net.URL solrUrl)
Constructs an instance for posting data to the specified Solr URL (ie: "http://localhost:8983/solr/update")

Method Detail

main

public static void main(java.lang.String[] args)

commit

public void commit(java.io.Writer output)
            throws java.io.IOException
Does a simple commit operation

Throws:
java.io.IOException

postFile

public void postFile(java.io.File file,
                     java.io.Writer output)
              throws java.io.FileNotFoundException,
                     java.io.UnsupportedEncodingException
Opens the file and posts it's contents to the solrUrl, writes to response to output.

Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException

postData

public void postData(java.io.Reader data,
                     java.io.Writer output)
Reads data from the data reader and posts it to solr, writes to the response to output



Copyright © 2006 - 2009 The Apache Software Foundation