org.apache.droids.handle
Class Solr

Package class diagram package Solr
java.lang.Object
  extended by org.apache.droids.handle.Solr
All Implemented Interfaces:
Handler

public class Solr
extends Object
implements Handler

Handler specialized for the communication with Apache Solr. Offers methods to generate the different commands for solr as e.g. createUpdateDocument(URL url, Parse parse)}

Make sure you have set the update url of your local solr server instance you want to use as destination.


Constructor Summary
Solr()
           
 
Method Summary
 ByteArrayOutputStream createCommitDocument()
          Creates a commit command.
 ByteArrayOutputStream createOptimizeDocument()
          Creates a optimize command.
 ByteArrayOutputStream createUpdateDocument(URL url, Parse parse)
          Creates an add command (and returns it as OutputStream) out of the parse result.
 String getUpdateUrl()
          Get the update url of the Apache Solr server in use
 void handle(InputStream openStream, URL url, Parse parse)
           
 void setUpdateUrl(String updateUrl)
          Set the update url of the Apache Solr server in use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Solr

public Solr()
Method Detail

handle

public void handle(InputStream openStream,
                   URL url,
                   Parse parse)
            throws Exception
Specified by:
handle in interface Handler
Parameters:
openStream - the underlying stream
url - the url we are currently processing
parse - the parse object from a former processing step
Throws:
Exception

createUpdateDocument

public ByteArrayOutputStream createUpdateDocument(URL url,
                                                  Parse parse)
                                           throws javax.xml.stream.XMLStreamException
Creates an add command (and returns it as OutputStream) out of the parse result. The content field will be filled with the Parse

Parameters:
url - the identifier for the document in Apache Solr
parse - the object that contains the textual representation of the document
Returns:
stream of the add command
Throws:
javax.xml.stream.XMLStreamException

createCommitDocument

public ByteArrayOutputStream createCommitDocument()
                                           throws javax.xml.stream.XMLStreamException
Creates a commit command.

Returns:
commit command as stream
Throws:
javax.xml.stream.XMLStreamException

createOptimizeDocument

public ByteArrayOutputStream createOptimizeDocument()
                                             throws javax.xml.stream.XMLStreamException
Creates a optimize command.

Returns:
optimize command as stream
Throws:
javax.xml.stream.XMLStreamException

getUpdateUrl

public String getUpdateUrl()
Get the update url of the Apache Solr server in use

Returns:
the update url of the Apache Solr server in use

setUpdateUrl

public void setUpdateUrl(String updateUrl)
Set the update url of the Apache Solr server in use

Parameters:
updateUrl - the update url of the Apache Solr server in use


Copyright © 2008 The Apache Software Foundation