documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Add guide on promoting or demoting certain documents

Open dichotommy opened this issue 3 years ago • 0 comments

Briefly:

  1. Add an attribute priority to all of your documents. The value should be a number with a value from 1 to 10.
  2. Add a custom ranking rule desc(priority) at the top (or somewhere close to the top) of the ranking rules list. This will sort all results by priority, with the highest values first (e.g. a document with priority 10 will show up at the top of the list, even if it doesn't match the query as well as documents below).
  3. Voilà, you now have 10 different promotion levels for your documents.

Example use case: you're running a clothing e-shop and you want garments that are on sale to show up above those that are list price. Create an attribute on-sale, and give it a value of either 0 (not on sale) or 1 (on sale), etc etc.

Similar to: https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/boost-or-penalize-some-records/

dichotommy avatar Apr 29 '21 15:04 dichotommy