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