The user can sort for the price. So in the query we need the logic that if
the current time is between a begin and end, then take this price else take
the defaultPrice. Is that possible? How can I do that?
Functions used in scoring can have filters. So theoretically you should
obtain what you want a first function with a date range filter and the
value of the time limited price and a second function, without filters
which has the value of the default price. You should probably use
"score_mode": "first" and "boos_mode": "replace" so that you only sort by
these functions.
I hope this idea helps a little.
Kind regards,
Florentin
Am Dienstag, 27. Mai 2014 13:46:52 UTC+2 schrieb Christof Kaleschke:
Hi,
we use an index with products that have a default price. For certain
periods of time a product can have a special price.
The user can sort for the price. So in the query we need the logic that if
the current time is between a begin and end, then take this price else take
the defaultPrice. Is that possible? How can I do that?
Another Idea, more like a brute force approach: keep a "current_price"
field and update it daily with a cron job, either with the default price or
with the promotional price. This way you only need to change a very little
in your queries (sort by the new field) and just add a job to "fix the
prices" daily.
This should be simpler solution than changing your queries to
function_score.
Florentin
Am Dienstag, 27. Mai 2014 13:46:52 UTC+2 schrieb Christof Kaleschke:
Hi,
we use an index with products that have a default price. For certain
periods of time a product can have a special price.
The user can sort for the price. So in the query we need the logic that if
the current time is between a begin and end, then take this price else take
the defaultPrice. Is that possible? How can I do that?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.