Have you thought storing 'availability' as a document instead of
'house'. So, the house, date range and price are a single document.
Then, you group them, sum them and in post-filter sort them?

Some ideas may come from:
http://www.slideshare.net/trenaman/personalized-search-on-the-largest-flash-sale-site-in-america
(though it is quite old by now)

Regards,
   Alex.
Personal: http://www.outerthoughts.com/ and @arafalov
Solr resources and newsletter: http://www.solr-start.com/ and @solrstart
Solr popularizers community: https://www.linkedin.com/groups?gid=6713853


On 4 December 2014 at 05:54, Mathijs Corten <m.cor...@bedandbreakfast.eu> wrote:
> Hello,
>
> *Usercase:*
> At this moment we have the current situation :
> We have customers that want to rent houses to visitors of our website.
> Customers can vary the prices according to specific dates, so renting a
> house at holidays will cost more.
>
> *The problems:*
>  - prices may vary according to the dates a visitor of the website
> specified.
>  - we want SOLR to calculate this total price based on base_price and the
> price_%DATE% dynamic fields
>  - we want SOLR to sort the result on this total price
>  - we want SOLR to return this price so we can display it on our website
>
> *Example:*
>
> house_id : 1
> base_price = 20    <- base price
> price_20141225 = 50    <- dynamic field with price for a specified date
> price_20141226 = 60    <- dynamic field with price for a specified date
>
> house_id : 2
> base_price = 30    <- base price
> price_20141229 = 50    <- dynamic field with price for a specified date
>
> Lets say a customer wants to rent a house from 2014-12-25 till 2014-12-30,
> the prices would be calculated at query time like this:
> House 1: 50 + 60 + 20 + 20 + 20
> House 2: 30 + 30 + 30 + 30 + 50
>
> *What **i already got:*
> I did some researche and made my own SearchComponent, which had a few
> problems:
>  - total price field that got added kept existing unless i removed it or
> restarted SOLR <- a problem with multiple search queries at the same time
>  - i could not sort on the totalprice field, field seemed to be unknown.
>
>
> *Now my question is:*
> Do any of you have any suggestions on how to add a total price field (based
> on base_price and dynamic fields), sort on it and return it to our website
> during query time?

Reply via email to