Query related to Scripts on Facets


(Rahul Sharma) #1

Hi,

Currently if I am not wrong scripts are run on each document. Can it be
done at Facet level. For example:

I have terms A and B which are part of an Index. Now I need an additional
term C = A * B and then I do aggregation on all 3 terms.
For term C I use statisticalScriptFacet and for rest I use *
statisticalFacet*

But looks like the script executes at each document level so it becomes
equivalent to Sum (A1 * B1 + A2 * B2 + A3 * B3 + .........+ An * Bn)

Whereas I need ---- Sum (A) * Sum (B)

Is there any easy way of achieving it without handling at the client level?

Thanks
Rahul


(Shay Banon) #2

Can'y you run one facet on A, one facet on B, and then multiple them on
your end?

On Thu, May 3, 2012 at 5:29 PM, Rahul Sharma
rahul.sharma.coder@gmail.comwrote:

Hi,

Currently if I am not wrong scripts are run on each document. Can it be
done at Facet level. For example:

I have terms A and B which are part of an Index. Now I need an additional
term C = A * B and then I do aggregation on all 3 terms.
For term C I use statisticalScriptFacet and for rest I use *
statisticalFacet*

But looks like the script executes at each document level so it becomes
equivalent to Sum (A1 * B1 + A2 * B2 + A3 * B3 + .........+ An * Bn)

Whereas I need ---- Sum (A) * Sum (B)

Is there any easy way of achieving it without handling at the client level?

Thanks
Rahul


(system) #3