org.apache.solr.util
Class SimplePostTool

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

public class SimplePostTool
extends 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 String DEFAULT_POST_URL
           
protected  URL solrUrl
           
static String VERSION_OF_THIS_TOOL
           
 
Constructor Summary
SimplePostTool(URL solrUrl)
          Constructs an instance for posting data to the specified Solr URL (ie: "http://localhost:8983/solr/update")
 
Method Summary
static String appendParam(String url, String param)
           
 void commit()
          Does a simple commit operation
static void doGet(String url)
          Performs a simple get on the given URL
static void doGet(URL url)
          Performs a simple get on the given URL
 String getFileTypes()
           
 boolean isAuto()
           
 boolean isRecursive()
           
static void main(String[] args)
           
 void optimize()
          Does a simple optimize operation
 void postData(InputStream data, Integer length, OutputStream output, String type)
           
 void postData(InputStream data, Integer length, OutputStream output, String type, URL url)
          Reads data from the data stream and posts it to solr, writes to the response to output
 void postFile(File file, OutputStream output, String type)
          Opens the file and posts it's contents to the solrUrl, writes to response to output.
 void setAuto(boolean auto)
           
 void setFileTypes(String fileTypes)
           
 void setRecursive(boolean recursive)
           
static InputStream stringToStream(String s)
           
 
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 String DEFAULT_POST_URL
See Also:
Constant Field Values

VERSION_OF_THIS_TOOL

public static final String VERSION_OF_THIS_TOOL
See Also:
Constant Field Values

solrUrl

protected URL solrUrl
Constructor Detail

SimplePostTool

public SimplePostTool(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(String[] args)

commit

public void commit()
Does a simple commit operation


optimize

public void optimize()
Does a simple optimize operation


appendParam

public static String appendParam(String url,
                                 String param)

postFile

public void postFile(File file,
                     OutputStream output,
                     String type)
Opens the file and posts it's contents to the solrUrl, writes to response to output.


doGet

public static void doGet(String url)
Performs a simple get on the given URL


doGet

public static void doGet(URL url)
Performs a simple get on the given URL


postData

public void postData(InputStream data,
                     Integer length,
                     OutputStream output,
                     String type)

postData

public void postData(InputStream data,
                     Integer length,
                     OutputStream output,
                     String type,
                     URL url)
Reads data from the data stream and posts it to solr, writes to the response to output


stringToStream

public static InputStream stringToStream(String s)

isAuto

public boolean isAuto()

setAuto

public void setAuto(boolean auto)

isRecursive

public boolean isRecursive()

setRecursive

public void setRecursive(boolean recursive)

getFileTypes

public String getFileTypes()

setFileTypes

public void setFileTypes(String fileTypes)


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.