Hi,
please take a look at Alba, a framework which simplifies the development of
new Solr plugins. You can write a plugin (e.g. custom function to be used
to boost/sort your docs or a custom Response Writer) in literally five
lines of code.

More specifically I think these two examples could be useful.

This is the basic example, which shows you how to write a function to
calculate the length of a text field and how to use that information for
boosting/sorting/filtering:
https://github.com/leonardofoderaro/alba/wiki/Your-first-Function-Query:-the-title-length

Here is a slightly more advanced example, how to a discount on books older
than X years:
https://github.com/leonardofoderaro/alba/wiki/discounting-old-books

Disclaimer 1: it has never been used in production.... yet ;-)

Disclaimer 2: I'm the author of the Alba Framework

Should you have any questions / issues / hints / PR  on how to improve it
please let me know.

best regards,
Leonardo










On Tue, Sep 29, 2015 at 8:36 PM, bbarani <bbar...@gmail.com> wrote:

> Hi,
>
> We have a price field in our SOLR XML feed that we currently use for
> 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.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Using-dynamically-calculated-value-for-sorting-tp4231950.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to