I have a question on filter scoring in Algolia. I would like to get an average of scores of a subset of the filters and then sum it up to the scores from other filters.
I have an index called posts. It has 3 attributes for faceting:
freshnessHoursOld: string e.g. 429685
locations: array of strings e.g. [Melboure, Sydney, Perth]
ageRange: string e.g. 50plus
In my Algolia query, I assign scores as follows
freshnessHoursOld:429685<score=50> or freshnessHoursOld:429600<score=10>
or location:Melboure<score=10> or location:Sydney<score=7> or
location:Perth<score=5> or ageRange:50plus<score=40>
The problem is – if a post has a location array of [Melboure, Sydney, Perth], then all three of the locations scores will match and the score for location match will be 10+7+5. The ageRange and freshnessHoursOld scores will also be added depending on the match.
What I want is - if a post has a location array of [Melboure, Sydney, Perth], then an average of the 3 is assigned for the location matches i.e. (10+7+5) /3 or just the highest or lowest of the 3 is used as the score for the location component. The ageRange and freshnessHoursOld scores will then also be added depending on the match.
I am aware of the parameter sumOrFiltersScores. But setting it to false means it takes the highest amongst all parameters - location, ageRange, freshnessHoursOld. And setting it to true means that it sums up the scores from all filter matches.
But I want the want to be able to take the highest or lowest or an average of the subset of the parameters which in this case is an array of locations. And the other scores (ageRange and freshnessHoursOld) also get added to this value when a match occurs.