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 Aakash Sabharwal <aa...@gmail.com> on 2016/07/15 01:37:28 UTC

Reusing `geodist()` value in a function query

Hello,

geodist calculations can be expensive so trying ways to optimize around it.
Particularly trying to figure out if sub-function queries are cached while
calculating an overall boost function for queries.

For example if I query with the below:


*q={!boost b=max(sub(abs(sub(geodist(),0.0)),1.6),
pow(abs(sub(geodist(),0.0)),1.2))}*

Will geodist() be invoked twice or will it be re-used?
I believe function queries do get converted to FunctionValues which is a
ValueSource. Are those always cached as DocValues or is that only in case
of field values?

Aakash

Re: Reusing `geodist()` value in a function query

Posted by Aakash Sabharwal <aa...@gmail.com>.
Hey!

Any help on this would be appreciated.
I tried tracing through the code and I couldn't find evidence of any level
of geodist() caching.

Aakash

On Thu, Jul 14, 2016 at 7:33 PM Aakash Sabharwal <aa...@gmail.com>
wrote:

> Alternatively if I do the following:
>
> *q={!boost b=max(sub(abs(sub($geodz,0.0)),1.6),
> pow(abs(sub($geodz,0.0)),1.2))}&geodz=geodist()*
>
> Does this lead to geodist() being recomputed or not?
>
>
>
>
>
> On Thu, Jul 14, 2016 at 6:37 PM Aakash Sabharwal <
> aakashsabharwal@gmail.com> wrote:
>
>> Hello,
>>
>> geodist calculations can be expensive so trying ways to optimize around
>> it.
>> Particularly trying to figure out if sub-function queries are cached
>> while calculating an overall boost function for queries.
>>
>> For example if I query with the below:
>>
>>
>> *q={!boost b=max(sub(abs(sub(geodist(),0.0)),1.6),
>> pow(abs(sub(geodist(),0.0)),1.2))}*
>>
>> Will geodist() be invoked twice or will it be re-used?
>> I believe function queries do get converted to FunctionValues which is a
>> ValueSource. Are those always cached as DocValues or is that only in case
>> of field values?
>>
>> Aakash
>>
>

Re: Reusing `geodist()` value in a function query

Posted by Aakash Sabharwal <aa...@gmail.com>.
Alternatively if I do the following:

*q={!boost b=max(sub(abs(sub($geodz,0.0)),1.6),
pow(abs(sub($geodz,0.0)),1.2))}&geodz=geodist()*

Does this lead to geodist() being recomputed or not?





On Thu, Jul 14, 2016 at 6:37 PM Aakash Sabharwal <aa...@gmail.com>
wrote:

> Hello,
>
> geodist calculations can be expensive so trying ways to optimize around it.
> Particularly trying to figure out if sub-function queries are cached while
> calculating an overall boost function for queries.
>
> For example if I query with the below:
>
>
> *q={!boost b=max(sub(abs(sub(geodist(),0.0)),1.6),
> pow(abs(sub(geodist(),0.0)),1.2))}*
>
> Will geodist() be invoked twice or will it be re-used?
> I believe function queries do get converted to FunctionValues which is a
> ValueSource. Are those always cached as DocValues or is that only in case
> of field values?
>
> Aakash
>