On 02. des. 2011 12:21, Mark Schoy wrote:
Hi,
I have an solr index for an online shop with a field "price" which
contains the standard price of a product.
But in the database, the shop owner can specify a period of time with
an alternative price.

For example: standard price is $20.00, but 12/24/11 08:00am to
12/26/11 11:59pm = $12.59
This is a problem that can be solved with grouping.
http://wiki.apache.org/solr/FieldCollapsing

For each possible price on a product, you index a document with the dates and the price. In your query, you group on the product, and apply a date-filter, and the price you see for each product will be from the top document within the given dates.
You can also sort by price. If you have multiple overlapping campaigns, 
you might need to pay attention to which one you want to take 
precedence, as your sorting will determine which document gets shown.
--
Morten
We all live in a yellow subroutine.

Reply via email to