: sorting. We are planning to introduce discounts based on login credentials : and we have to dynamically calculate price (using base price in SOLR feed) : based on a specific discount returned by an API. Now after the discount is : calculated we want to sort based on the new price (discounted price). : : What is the best way to do that? Any ideas would be appreciated.
It's hard to provide a completley generic answer to your question w/o more details in terms of how you define "discount" if the discount is a fixed amount, or fixed percentage, for all documents returned from the index for that user, then you can use simple functions to do something like "sort=min(0,sub(price,flat_discount)) asc, popularity desc" https://cwiki.apache.org/confluence/display/solr/Function+Queries If the discount depends on other factors, then you have to explain what those other factors are -- if they can be represented as a numerical calculation based entirely on a single (or small number) of constants you pass in to hte query based on the userid, plus some numerical values in every document, then you can probably expand on that type of solution even more. But w/o knowing hte details, it's hard to give you any further guidance. -Hoss http://www.lucidworks.com/