org.apache.solr.handler.dataimport
Class SolrWriter

java.lang.Object
  extended by org.apache.solr.handler.dataimport.SolrWriter

public abstract class SolrWriter
extends Object

Writes documents to SOLR as well as provides methods for loading and persisting last index time.

This API is experimental and may change in the future.

Since:
solr 1.3
Version:
$Id: SolrWriter.java 690134 2008-08-29 07:18:52Z shalin $

Nested Class Summary
static interface SolrWriter.SolrDoc
          The purpose of this interface to provide pluggable implementations for Solr 1.2 & 1.3 The implementation can choose to wrap appropriate Objects based on the version
 
Field Summary
static int DISABLE_LOGGING
           
static int ENABLE_LOGGING
           
static int END_DOC
           
static int END_ENTITY
           
static int ENTITY_EXCEPTION
           
static int ENTITY_META
           
static int ENTITY_OUT
           
static int PRE_TRANSFORMER_ROW
           
static int ROW_END
           
static int START_DOC
           
static int START_ENTITY
           
static int TRANSFORMED_ROW
           
static int TRANSFORMER_EXCEPTION
           
 
Constructor Summary
SolrWriter(UpdateRequestProcessor processor, String confDir)
           
 
Method Summary
 void commit(boolean optimize)
           
 void deleteByQuery(String query)
           
 void deleteDoc(Object id)
           
 void doDeleteAll()
           
abstract  SolrWriter.SolrDoc getSolrDocInstance()
           
 Date loadIndexStartTime()
           
abstract  void log(int event, String name, Object row)
          This method is used for verbose debugging
 void persistIndexStartTime(Date date)
           Stores the last indexed time into the IMPORTER_PROPERTIES file.
 boolean upload(SolrInputDocument d)
           
abstract  boolean upload(SolrWriter.SolrDoc d)
           Write the document to the index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

START_ENTITY

public static final int START_ENTITY
See Also:
Constant Field Values

END_ENTITY

public static final int END_ENTITY
See Also:
Constant Field Values

TRANSFORMED_ROW

public static final int TRANSFORMED_ROW
See Also:
Constant Field Values

ENTITY_META

public static final int ENTITY_META
See Also:
Constant Field Values

PRE_TRANSFORMER_ROW

public static final int PRE_TRANSFORMER_ROW
See Also:
Constant Field Values

START_DOC

public static final int START_DOC
See Also:
Constant Field Values

END_DOC

public static final int END_DOC
See Also:
Constant Field Values

ENTITY_OUT

public static final int ENTITY_OUT
See Also:
Constant Field Values

ROW_END

public static final int ROW_END
See Also:
Constant Field Values

TRANSFORMER_EXCEPTION

public static final int TRANSFORMER_EXCEPTION
See Also:
Constant Field Values

ENTITY_EXCEPTION

public static final int ENTITY_EXCEPTION
See Also:
Constant Field Values

DISABLE_LOGGING

public static final int DISABLE_LOGGING
See Also:
Constant Field Values

ENABLE_LOGGING

public static final int ENABLE_LOGGING
See Also:
Constant Field Values
Constructor Detail

SolrWriter

public SolrWriter(UpdateRequestProcessor processor,
                  String confDir)
Method Detail

upload

public boolean upload(SolrInputDocument d)

deleteDoc

public void deleteDoc(Object id)

deleteByQuery

public void deleteByQuery(String query)

commit

public void commit(boolean optimize)

doDeleteAll

public void doDeleteAll()

loadIndexStartTime

public Date loadIndexStartTime()

persistIndexStartTime

public void persistIndexStartTime(Date date)

Stores the last indexed time into the IMPORTER_PROPERTIES file. If any properties are already defined in the file, then they are preserved.

Parameters:
date - the Date instance to be persisted

getSolrDocInstance

public abstract SolrWriter.SolrDoc getSolrDocInstance()

upload

public abstract boolean upload(SolrWriter.SolrDoc d)

Write the document to the index

Parameters:
d - . The Document warapper object
Returns:
a boolean value denoting success (true) or failure (false)

log

public abstract void log(int event,
                         String name,
                         Object row)
This method is used for verbose debugging

Parameters:
event - The event name start.entity ,end.entity ,transformer.row
name - Name of the entity/transformer
row - The actual data . Can be a Map or a List>


Copyright © 2008 Apache Software Foundation. All Rights Reserved.