Class SqlEntityProcessor
- java.lang.Object
-
- org.apache.solr.handler.dataimport.EntityProcessor
-
- org.apache.solr.handler.dataimport.EntityProcessorBase
-
- org.apache.solr.handler.dataimport.SqlEntityProcessor
-
public class SqlEntityProcessor extends EntityProcessorBase
An
EntityProcessor
instance which provides support for reading from databases. It is used in conjunction withJdbcDataSource
. This is the defaultEntityProcessor
if none is specified explicitly in data-config.xmlRefer to http://wiki.apache.org/solr/DataImportHandler for more details.
This API is experimental and may change in the future.
- Since:
- solr 1.3
-
-
Field Summary
Fields Modifier and Type Field Description protected DataSource<Iterator<Map<String,Object>>>
dataSource
static String
DEL_PK_QUERY
static String
DELTA_IMPORT_QUERY
static String
DELTA_QUERY
static Pattern
DOT_PATTERN
static String
PARENT_DELTA_QUERY
static String
QUERY
-
Fields inherited from class org.apache.solr.handler.dataimport.EntityProcessorBase
ABORT, cacheSupport, context, CONTINUE, entityName, isFirstInit, ON_ERROR, onError, query, rowIterator, SKIP, TRANSFORM_ROW, TRANSFORMER
-
-
Constructor Summary
Constructors Constructor Description SqlEntityProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDeltaImportQuery(String queryString)
String
getQuery()
void
init(Context context)
This method is called when it starts processing an entity.protected void
initQuery(String q)
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.EntityProcessorBase
destroy, firstInit, getNext, initCache
-
Methods inherited from class org.apache.solr.handler.dataimport.EntityProcessor
close, postTransform
-
-
-
-
Field Detail
-
dataSource
protected DataSource<Iterator<Map<String,Object>>> dataSource
-
QUERY
public static final String QUERY
- See Also:
- Constant Field Values
-
DELTA_QUERY
public static final String DELTA_QUERY
- See Also:
- Constant Field Values
-
DELTA_IMPORT_QUERY
public static final String DELTA_IMPORT_QUERY
- See Also:
- Constant Field Values
-
PARENT_DELTA_QUERY
public static final String PARENT_DELTA_QUERY
- See Also:
- Constant Field Values
-
DEL_PK_QUERY
public static final String DEL_PK_QUERY
- See Also:
- Constant Field Values
-
DOT_PATTERN
public static final Pattern DOT_PATTERN
-
-
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- Overrides:
init
in classEntityProcessorBase
- Parameters:
context
- The current context
-
initQuery
protected void initQuery(String q)
-
nextRow
public Map<String,Object> nextRow()
Description copied from class:EntityProcessorBase
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- Overrides:
nextRow
in classEntityProcessorBase
- 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
-
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- Overrides:
nextModifiedRowKey
in classEntityProcessorBase
- 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- Overrides:
nextDeletedRowKey
in classEntityProcessorBase
- 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.- Overrides:
nextModifiedParentRowKey
in classEntityProcessorBase
- Returns:
- the pk vs value of all changed rows in the parent entity
-
getQuery
public String getQuery()
-
-