mirror of https://github.com/apache/lucene.git
SOLR-1120 follow up -- Adding a postTransform hook in EntityProcessor which can be used to add, remove and modify variables added by Transformers
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@783750 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e81632efa
commit
9306b481e3
|
@ -96,6 +96,15 @@ public abstract class EntityProcessor {
|
|||
*/
|
||||
public abstract void destroy();
|
||||
|
||||
/**
|
||||
* Invoked after the transformers are invoked. EntityProcessors can add, remove or modify values
|
||||
* added by Transformers in this method.
|
||||
*
|
||||
* @param r The transformed row
|
||||
*/
|
||||
public void postTransform(Map<String, Object> r) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the Entity processor is detroyed. towards the end of import.
|
||||
*/
|
||||
|
|
|
@ -233,7 +233,10 @@ public class EntityProcessorWrapper extends EntityProcessor {
|
|||
return null;
|
||||
} else {
|
||||
arow = applyTransformer(arow);
|
||||
if (arow != null) return arow;
|
||||
if (arow != null) {
|
||||
delegate.postTransform(arow);
|
||||
return arow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,6 +172,11 @@ public class XPathEntityProcessor extends EntityProcessorBase {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postTransform(Map<String, Object> r) {
|
||||
readUsefulVars(r);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Object> fetchNextRow() {
|
||||
Map<String, Object> r = null;
|
||||
|
|
Loading…
Reference in New Issue