Class EntityProcessorBase
- java.lang.Object
-
- org.apache.solr.handler.dataimport.EntityProcessor
-
- org.apache.solr.handler.dataimport.EntityProcessorBase
-
- Direct Known Subclasses:
FileListEntityProcessor
,LineEntityProcessor
,PlainTextEntityProcessor
,SolrEntityProcessor
,SqlEntityProcessor
,XPathEntityProcessor
public class EntityProcessorBase extends EntityProcessor
Base class for all implementations of
EntityProcessor
Most implementations of
EntityProcessor
extend this base class which provides common functionality.This API is experimental and subject to change
- Since:
- solr 1.3
-
-
Field Summary
Fields Modifier and Type Field Description static String
ABORT
protected DIHCacheSupport
cacheSupport
protected Context
context
static String
CONTINUE
protected String
entityName
protected boolean
isFirstInit
static String
ON_ERROR
protected String
onError
protected String
query
protected Iterator<Map<String,Object>>
rowIterator
static String
SKIP
static String
TRANSFORM_ROW
static String
TRANSFORMER
-
Constructor Summary
Constructors Constructor Description EntityProcessorBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Invoked for each entity at the very end of the import to do any needed cleanup tasks.protected void
firstInit(Context context)
first time init call.protected Map<String,Object>
getNext()
void
init(Context context)
This method is called when it starts processing an entity.protected void
initCache(Context context)
Map<String,Object>
nextDeletedRowKey()
This is used during delta-import.Map<String,Object>
nextModifiedParentRowKey()
This is used during delta-import.Map<String,Object>
nextModifiedRowKey()
This is used for delta-import.Map<String,Object>
nextRow()
For a simple implementation, this is the only method that the sub-class should implement.-
Methods inherited from class org.apache.solr.handler.dataimport.EntityProcessor
close, postTransform
-
-
-
-
Field Detail
-
isFirstInit
protected boolean isFirstInit
-
entityName
protected String entityName
-
context
protected Context context
-
query
protected String query
-
onError
protected String onError
-
cacheSupport
protected DIHCacheSupport cacheSupport
-
TRANSFORMER
public static final String TRANSFORMER
- See Also:
- Constant Field Values
-
TRANSFORM_ROW
public static final String TRANSFORM_ROW
- See Also:
- Constant Field Values
-
ON_ERROR
public static final String ON_ERROR
- See Also:
- Constant Field Values
-
ABORT
public static final String ABORT
- See Also:
- Constant Field Values
-
CONTINUE
public static final String CONTINUE
- See Also:
- Constant Field Values
-
SKIP
public static final String SKIP
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(Context context)
Description copied from class:EntityProcessor
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- Specified by:
init
in classEntityProcessor
- Parameters:
context
- The current context
-
firstInit
protected void firstInit(Context context)
first time init call. do one-time operations here it's necessary to call it from the overridden method, otherwise it throws NPE on accessing zipper from nextRow()
-
initCache
protected void initCache(Context context)
-
nextModifiedRowKey
public Map<String,Object> nextModifiedRowKey()
Description copied from class:EntityProcessor
This is used for delta-import. It gives the pks of the changed rows in this entity- Specified by:
nextModifiedRowKey
in classEntityProcessor
- Returns:
- the pk vs value of all changed rows
-
nextDeletedRowKey
public Map<String,Object> nextDeletedRowKey()
Description copied from class:EntityProcessor
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- Specified by:
nextDeletedRowKey
in classEntityProcessor
- Returns:
- the pk vs value of all changed rows
-
nextModifiedParentRowKey
public Map<String,Object> nextModifiedParentRowKey()
Description copied from class:EntityProcessor
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.- Specified by:
nextModifiedParentRowKey
in classEntityProcessor
- Returns:
- the pk vs value of all changed rows in the parent entity
-
nextRow
public Map<String,Object> nextRow()
For a simple implementation, this is the only method that the sub-class should implement. This is intended to stream rows one-by-one. Return null to signal end of rows- Specified by:
nextRow
in classEntityProcessor
- Returns:
- a row where the key is the name of the field and value can be any Object or a Collection of objects. Return null to signal end of rows
-
destroy
public void destroy()
Description copied from class:EntityProcessor
Invoked for each entity at the very end of the import to do any needed cleanup tasks.- Specified by:
destroy
in classEntityProcessor
-
-