Hi Alex, this is not a simple problem. In your domain we can consider a Product as a document and the list of <Price> nested Documents. Ideally we would model the Product as the father and the prices as children. Each <Price> will be defined by :
- *start_date * - *end_date * - *price * - *productId* We can define 2 collections this way and play with Joins and faceting. Take a look here : http://lucene.472066.n3.nabble.com/How-do-I-get-faceting-to-work-with-Solr-JOINs-td4147785.html#a4148838 If redundancy of data is not a problem for you, you can proceed with a simple approach where you add redundant documents. Each document will have the start_date,end_date and price as single value fields. In the redundant scenario, the approach to follow is quite easy : - always filtering by date the docs and then proceed faceting . Cheers 2015-05-21 13:58 GMT+01:00 alexw <aw...@crossview.com>: > Hi, > > I have an unique requirement to facet on product prices based on date > constraints, for which I have been thinking for a solution for a couple of > days now, but to no avail. The details are as follows: > > 1. Each product can have multiple prices, each price has a start-date and > an > end-date. > 2. At search time, we need to facet on price ranges ($0 - $5, $5-$20, > $20-$50...) > 3. When faceting, a date is first determined. It can be either the current > system date or a future date (call it date X) > 4. For each product, the price to be used for faceting has to meet the > following condition: start-date < date X, and date X < end-date, in other > words, date X has to fall within start-date and end-date. > 5. My Solr version: 3.5 > > Hopefully I explained the requirement clearly. I have tried single price > field with multivalue and each price value has startdate and enddate > appended. I also tried one field per price with the field name containing > both startdate and enddate. Neither approach seems to work. Can someone > please shed some light as to how the index should be designed and what the > facet query should look like? > > Thanks in advance for your help! > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Price-Range-Faceting-Based-on-Date-Constraints-tp4206817.html > Sent from the Solr - User mailing list archive at Nabble.com. > -- -------------------------- Benedetti Alessandro Visiting card : http://about.me/alessandro_benedetti "Tyger, tyger burning bright In the forests of the night, What immortal hand or eye Could frame thy fearful symmetry?" William Blake - Songs of Experience -1794 England