Assign weight to attribute based on there value is grater or lesser then some value

Hi I am trying to find a search solution where I can assign a weight (x point) to an attribute if its value is greater or smaller then some value ( Y value)

Like if the price is greater then 10 USD then assign 5 points to the item, and I am assigning points on multiple attribute, then get the list of item on the bases of total points in asc or desc order, how can i do this in algolia

Hello,

Algolia does not expose “weight” like other technology would do.
Everything is computed using a unified ranking strategy:
see documentation: https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/

Usually it’s better to use sorting on price and let the ranking strategy put the more textually relevant results on top.
If you have multiple “weight” you can put multiple sort in the custom ranking.


If you still wish to compute a weight, it’s still doable by computing it on your side, putting it in a dedicated property in your record and use a custom ranking (sort) on this property.

e:g

{
  "price": 10,
  "weight_price": 5,
}

Thanks @samuel.bodin, I am doing first place search and after getting lat long, I am doing algolia search with lat and long with some criteria like item * Within 1km: 40 points, * Within 2km: 20 points, * Within 5km: 10 points, is it possible ?,

In that case the proposed solution of computing the weight in a property will not work indeed.
Fortunately you can also order by Radius, using aroundRadius. This will still not be “point based” but will sort results from nearest to farthest (basically what you want I believe)

see documentation here: