Complex “featured product” model using query-time ranking (optional filters)

夙愿已清 提交于 2019-12-12 19:53:22

问题


I have a products index that displays filtered results on category pages.

  1. For a given category, any amount of products may be flagged as featured, meaning it displays first.
  2. 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)
  3. 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

A solution to 1. has been posted here: https://stackoverflow.com/a/40922535 using optional filters, currently in private beta: https://www.algolia.com/doc/advanced/optional-filters-scoring/. At query time I could do optionalFacetFilters: ["featuredIn.category:category1"] Update: I've since been told by Algolia reps that this feature is has a large performance cost, and therefor is only really viable for enterprise customers.

However, I'm at a loss as to how to pull of 2. and 3..

Any guidance is greatly appreciated!

来源:https://stackoverflow.com/questions/41166479/complex-featured-product-model-using-query-time-ranking-optional-filters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!