Hello. I work with Solr 4.10.
I use DIH and some custom java Transformers to synchronize my Solr index
with the database (MySQL is used)
Is there any way to change the fields in root entity from the sub entity?
I mean something like this

public class MySubEntityTransformer extends
org.apache.solr.handler.dataimport.Transformer {
    @Override
    public Object transformRow(Map<String, Object> row, Context context) {
        Map<String, Object> parentRow = context.getParentContext().....?
        Object val = row.get("subEnityColumn");
        if (val != null) {
            //transform this value some way
            Object generalValue = parentRow.get("documentField");
            if (generalValue != null) {
                  parentRow.put("documentField", generalValue + "_" + val);
            } else {
                   parentRow.put("documentField", val);
            }
        }
        return row;
    }
}

Or is there any way to apply some kind of the transformation for the root
entity after all its subentities has been processed?

I can't use the script transformers, because they works many times slower
than java extensions.






--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-DIH-sub-entity-tp4227167.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to