Hello,

First of all you can have an access to the context, where the parent entity
fields can be obtained from (following your link):

The semantics of execution is same as that of a java transformer. The
method can have two arguments as in 'transformRow(Map<String,Object> ,
Context context) in the abstract class 'Transformer' . As it is javascript
the second argument may be omittted and it still works.

then,

generally it sounds like a copyfield
http://wiki.apache.org/solr/SchemaXml#Copy_Fields have you considered it?

On Sat, Mar 10, 2012 at 3:42 PM, Chamnap Chhorn <chamnapchh...@gmail.com>wrote:

> Hi all,
>
> I'm using DIH solr 3.5 to import data from mysql. In my document, I have
> some fields: name, category, text_spell, ...
> text_spell is a multi-valued field which combines from name and category
> (category is a multi-value field as well).
>
> <entity name="listing"
>            query="SELECT uuid, name from listings" pk="uuid">
>   <entity name="listing_categories"
>              query="SELECT `categories`.`name` FROM categories INNER JOIN
> `listing_categories` ON
> `categories`.`uuid`=`listing_categories`.`category_uuid`) WHERE
> `listing_categories`.`listing_uuid`='${listing.uuid}'">
>        <field column="name" name="category" />
>   </entity>
> </entity>
>
> In this case, I would use ScriptTransformer to produce a new array of
> [name, category], but the from the example in solr
> wiki<http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer>,
> it seems it could only access the current row in the current entity.
> Is it possible to access other entities?
>
> If not possible, how could i solve this problem. I know I could use UNION
> statement, but it duplicates the query and it would degrade the performance
> as well. Any idea?
>
> --
> Chamnap
>



-- 
Sincerely yours
Mikhail Khludnev
Lucid Certified
Apache Lucene/Solr Developer
Grid Dynamics

<http://www.griddynamics.com>
 <mkhlud...@griddynamics.com>

Reply via email to