On Fri, Mar 11, 2011 at 10:23 AM, Jason Rutherglen
<jason.rutherg...@gmail.com> wrote:
> Right that's not within the XML however, and it's unclear how to
> access the upper level entities that have already been instantiated,
> eg, beyond the given 'transform' row.

The second example for a ScriptTransformer in
http://wiki.apache.org/solr/DataImportHandler#Transformer
should give you an idea of how to proceed:
* row.get( 'category' ) gets the field 'category' from the
  current entity to which the ScriptTransformer is being
  applied.
* Fields from higher-level entities will need to be passed
  in using DIH variables. E.g., if you have a higher-level
  entity called 'parent', and are getting data from the current
  entity via a database select, e.g.,
     <entity... query="select category from mytable">
 you will need to modify the query to something like
     <entity... transformer="script:mytrans" query="select category
from mytable, ${parent.id} as id">
 and add
     <field column="id">
 inside the current entity (cannot remember now if this is
 required, or can be dispensed with).

Regards,
Gora

Reply via email to