lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathijs Corten <m.cor...@bedandbreakfast.eu>
Subject Custom SOLR plugin that returns a field + where you can sort on that field
Date Thu, 04 Dec 2014 10:54:16 GMT
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?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message