Cross-posting this here from Stack Exchange, as I haven’t gotten much traction there: http://stackoverflow.com/questions/41166479/complex-featured-product-model-using-query-time-ranking-optional-filters
I have a products index that displays filtered results on category pages.
For a given category, any amount of products may be flagged as featured, meaning it displays first.
When products are displayed for a category, only one featured product should show at a time (at random from the available products flagged as featured)
Additionally, a product should not be flagged as featured if it has date range fields and the current date is not within the range
So, my index might look something like: https://gist.github.com/1a0327d8a321dc6627e197b94f4209c9
It seems like I need to perform 2 queries, but I don’t know how to combine them without throwing off pagination and totals.
Any guidance is greatly appreciated!