That is *very* clever and will almost certainly work. My only concern is that it doubles the overhead (and has a not insignificant effect on the complexity of my code) for what is essentially a minor feature. I'd like to keep this approach on the back-burner and see if a more conventional solution exists. Very nice idea though.

- Andy

Erick Erickson wrote:
Would it work to index the item N times, where N is the number
of discrete date ranges?

Say you had a hat that was $10 from 1/1/09 to 6/30/09 and $11 from
7/1/09 to 12/30/09. Just index it twice with the dates something like
valid_from, valid_to. Then form your queries so you were looking
in the proper date...

No idea if this *really* helps or not.

Best
Erick

On Wed, May 6, 2009 at 7:32 AM, Andrew Ingram <a...@andrewingram.net> wrote:

Hi everyone,

I'm working on the search schema for ecommerce products and I'm having
an issue with the prices.

Basically, a product has two price values and a date, the product
effectively has one price before the date and the other one after.
This poses no problem for the site itself since I can use conditional
logic, but I have no idea how to approach this with regards to solr
queries.

The price of a product is used for both faceting and sorting and
should use whichever price is active at the time of the query. Is
there any way to do define a field whose value is a simple algorithm
operating on the value of other fields?

I'm quite happy to use a custom field type if necessary, though I'm
not sure if what I want is even possible and I don't really know where
to begin.

Any help would be appreciated

Regards,
Andrew Ingram



Reply via email to