org.apache.solr.handler.dataimport
Class EntityProcessor

java.lang.Object
  extended by org.apache.solr.handler.dataimport.EntityProcessor
Direct Known Subclasses:
EntityProcessorBase, EntityProcessorWrapper

public abstract class EntityProcessor
extends Object

An instance of entity processor serves an entity. It is reused throughout the import process.

Implementations of this abstract class must provide a public no-args constructor.

Refer to http://wiki.apache.org/solr/DataImportHandler for more details.

This API is experimental and may change in the future.

Since:
solr 1.3

Constructor Summary
EntityProcessor()
           
 
Method Summary
 void close()
          Invoked when the Entity processor is destroyed towards the end of import.
abstract  void destroy()
          Invoked for each entity at the very end of the import to do any needed cleanup tasks.
abstract  void init(Context context)
          This method is called when it starts processing an entity.
abstract  Map<String,Object> nextDeletedRowKey()
          This is used during delta-import.
abstract  Map<String,Object> nextModifiedParentRowKey()
          This is used during delta-import.
abstract  Map<String,Object> nextModifiedRowKey()
          This is used for delta-import.
abstract  Map<String,Object> nextRow()
          This method helps streaming the data for each row .
 void postTransform(Map<String,Object> r)
          Invoked after the transformers are invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityProcessor

public EntityProcessor()
Method Detail

init

public abstract void init(Context context)
This method is called when it starts processing an entity. When it comes back to the entity it is called again. So it can reset anything at that point. For a rootmost entity this is called only once for an ingestion. For sub-entities , this is called multiple once for each row from its parent entity

Parameters:
context - The current context

nextRow

public abstract Map<String,Object> nextRow()
This method helps streaming the data for each row . The implementation would fetch as many rows as needed and gives one 'row' at a time. Only this method is used during a full import

Returns:
A 'row'. The 'key' for the map is the column name and the 'value' is the value of that column. If there are no more rows to be returned, return 'null'

nextModifiedRowKey

public abstract Map<String,Object> nextModifiedRowKey()
This is used for delta-import. It gives the pks of the changed rows in this entity

Returns:
the pk vs value of all changed rows

nextDeletedRowKey

public abstract Map<String,Object> nextDeletedRowKey()
This is used during delta-import. It gives the primary keys of the rows that are deleted from this entity. If this entity is the root entity, solr document is deleted. If this is a sub-entity, the Solr document is considered as 'changed' and will be recreated

Returns:
the pk vs value of all changed rows

nextModifiedParentRowKey

public abstract Map<String,Object> nextModifiedParentRowKey()
This is used during delta-import. This gives the primary keys and their values of all the rows changed in a parent entity due to changes in this entity.

Returns:
the pk vs value of all changed rows in the parent entity

destroy

public abstract void destroy()
Invoked for each entity at the very end of the import to do any needed cleanup tasks.


postTransform

public void postTransform(Map<String,Object> r)
Invoked after the transformers are invoked. EntityProcessors can add, remove or modify values added by Transformers in this method.

Parameters:
r - The transformed row
Since:
solr 1.4

close

public void close()
Invoked when the Entity processor is destroyed towards the end of import.

Since:
solr 1.4


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