On Tue, Jul 19, 2011 at 6:49 PM, solr nps <solr...@gmail.com> wrote: > My documents have two prices "retail_price" and "current_price". I want to > get products which have a sale of x%, the x is dynamic and can be specified > by the user. I was trying to achieve this by using fq. > > If I want all sony tv's that are at least 20% off, I want to write something > like > > q="sony tv"&fq=current_price:[0 TO product(retail_price,0.80)] > > this does not work as the function is not expected in fq. > > how else can I achieve this?
The frange query parser may do what you want. http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/ fq={!frange l=0 u=0.8}div(current_price, retail_price) -Yonik http://www.lucidimagination.com