You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Joel Nylund <jn...@yahoo.com> on 2009/12/02 14:50:15 UTC

getting value from parent query in subquery transformer

Hi, I have an entity that has a entity within it that executes a query  
for each row and calls a transformer. Is there a way to pass a value  
from the parent query into the transformer?

For example, I have an entity called document, and it it has an ID and  
sometimes it has a category.

I have a sub entity called category that does another complex query  
using the documents ID to get data to send to the transformer to  
determine the category. I would like to pass the parents category to  
this transformer, so I dont have to join in data I already have. Is  
this possible?

Im using ${item.id} in the where clause, so I guess im wondering, can  
I do something like.....

<entity name="item" query="..........
     	<entity name="category"  
transformer="script:SplitAndPrettyCategory(${item.category})"  
query="......

thanks
Joel

Re: getting value from parent query in subquery transformer

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
you do not need to pass the values as shown here. Make use of the
Context parameter (second implicit parameter) to get hold of the value
of ${item.category}

context.getVariableResolver().resolve('item.category'))

On Wed, Dec 2, 2009 at 7:20 PM, Joel Nylund <jn...@yahoo.com> wrote:
> Hi, I have an entity that has a entity within it that executes a query for
> each row and calls a transformer. Is there a way to pass a value from the
> parent query into the transformer?
>
> For example, I have an entity called document, and it it has an ID and
> sometimes it has a category.
>
> I have a sub entity called category that does another complex query using
> the documents ID to get data to send to the transformer to determine the
> category. I would like to pass the parents category to this transformer, so
> I dont have to join in data I already have. Is this possible?
>
> Im using ${item.id} in the where clause, so I guess im wondering, can I do
> something like.....
>
> <entity name="item" query="..........
>        <entity name="category"
> transformer="script:SplitAndPrettyCategory(${item.category})" query="......
>
> thanks
> Joel
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com