Solr - Return field value after multiplication

522 Views Asked by At

I am learning Solr and trying to explore solr function query. I have created a simple solr query which returns result as below:

<doc> 
    <float name="price">0.0</float> 
</doc> 
<doc> 
    <float name="price">92.0</float> 
</doc> 
<doc>
    <float name="price">350.0</float> 
</doc>

I have tried changing query by including a new field in "Field to return"(say newPrice) which should be more than 100 than price field value. below is the addition into query -

price,newPrice:sum(price,100).

But i am not able to see any change in response - Please help to understand the gap. Thanks in advance...

1

There are 1 best solutions below

0
On

Make your Query Like This:

select?q=*:*&wt=json&indent=true&fl=price,newPrice:product(sum(100,price))