vatu...@yandex.ru wrote:
> 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 don't think that works, but if you are writing your own transformer, you 
should be able to associate the transformer with the parent and run your 
sub-entity query from within the transformer.   You may also want to look at 
using a ScriptTransformer to avoid writing Java code that needs to be compiled 
outside of the DIH.

Also, the main benefit of DIH is simplicity - it doesn't multi-thread well, it 
doesn't have a well-behaved cand it cannot choose any SolrCloud node when 
pushing data.   If you are already writing transformers in Java, you may want 
to look at separating your transformations from Java to take advantage of at 
least multi-threading, and even multiple machines (e.g. big data).   

I guess it all depends on how much DIH you have, and how much you've invested 
in it.

-----Original Message-----
From: vatuska [mailto:vatu...@yandex.ru] 
Sent: Friday, September 04, 2015 6:49 AM
To: solr-user@lucene.apache.org
Subject: Solr DIH 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