Hi Mark,
I'm sure you can manage this using function queries somehow, but this is
rather complicated, esp. if you both want to return the price and sort
on it.
I'd rather update the index as soon as a campaign starts or ends. At
least that's how we did it when I worked for online shops. Normally this
isn't a matter of seconds, and you would need to update Solr anyway when
you create such a campaign.
As a benefit, you're not limited in the number of running campaigns (at
least not on the Solr side). Maybe you want to plan a campaign when the
current one hasn't ended yet, which would be (nearly) impossible when
you calculate the price at query time.
Greetings,
Kuli
Am 02.12.2011 12:21, schrieb Mark Schoy:
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
Of course I could use an cronjob to updating the documents. But I
think this is too unstable.
I also could save all price campaigns in a field an then extracting
the correct price. But then I could not sort by price or only by the
standard price.
What I need is an field where I can put a condition like that: if
[current_time between one of the price campains] then [return price of
price campaign]. But (unfortunately) this is not possible.
Thanks for advice.