Hello Chris,

Thanks for the pointers.

I feel min, max for any numeric field won't be calculated at runtime, so,
was wondering about any option to use those stats for a field in the boost
function using edismax.
If I get any option, I will mention it.


On Tue, Apr 9, 2024 at 12:01 AM Chris Hostetter <hossman_luc...@fucit.org>
wrote:

>
> Check the docs for min & max functions -- they don't do what you seem to
> think they do...
>
>
> https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html#max-function
>
> >> Returns the maximum numeric value of multiple nested functions or
> >> constants, which are specified as arguments: max(x,y,...)
>
> They also both have a pointer to the function that does do what you
> want...
>
> >> Use the field(myfield,max) syntax for selecting the maximum value of a
> >> single multivalued field.
>
>
> https://solr.apache.org/guide/solr/latest/query-guide/function-queries.html#field-function
>
>
>
> : Date: Tue, 2 Apr 2024 12:34:42 +0530
> : From: govind nitk <govind.n...@gmail.com>
> : Reply-To: users@solr.apache.org
> : To: users@solr.apache.org
> : Subject: Using min/max value of field in boost query
> :
> : Hi,
> :
> : currently a working solution is like:
> : 1. First api call - take min, max value of numeric fields say price field
> : 2. In another api call to solr use it like
> :     bq="div(sub(price,min_price),sub(max_price,sum(1,min_price)))^0.05"
> :
> : above is a working solution, but its two api based.
> : Can we use the min/max values in boost using function queries ?
> :
> : I tried with local param reference
> : ex.
> :
> min_price=min(price)&max_price=max(price)&bq="div(sub(price,$min_price),sub($max_price,sum(1,$min_price)))^0.05"
> :
> : This is not giving an error, but min_price is the same as price; so
> : sub(price,min_price) is zero and boost finally applied is zero.
> :
> : Is there any option to achieve this?
> :
>
> -Hoss
> http://www.lucidworks.com/
>

Reply via email to