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 Pulkit Singhal <pu...@gmail.com> on 2011/09/22 23:37:18 UTC

ScriptTransformer question

Hello,

I'm using DIH in the trunk version and I have placed breakpoints in
the Solr code.
I can see that the value for a row being fed into the
ScriptTransformer instance is:
{buybackPlans.buybackPlan.type=[PSP-PRP],
buybackPlans.buybackPlan.name=[2-Year Buy Back Plan],
buybackPlans.buybackPlan.sku=[2490748],
$forEach=/products/product/buybackPlans/buybackPlan,
buybackPlans.buybackPlan.price=[]}

Now price cannot be empty because Solr will complain so the following
script should be running but it doesn't do anything!!!
Can anyone spot the issue here?
        function skipEmptyFieldsInBuybackPlans(row) {
            var buybackPlans_buybackPlan_price = row.get(
'buybackPlans.buybackPlan.price' );
            if ( buybackPlans_buybackPlan_price == null ||
                 buybackPlans_buybackPlan_price == '' ||
                 buybackPlans_buybackPlan_price.length == 0)
            {
                row.remove( 'buybackPlans.buybackPlan.price' );
            }
            return row;
        }
I would hate to have to get the rhino javascript engine source code
and step-through that.
I'm sure I'm being really dumb and am hoping that someone on the Solr
mailing list can help me spot the issue :)

Thanks!
- Pulkit