Calculating attribute (of each result record) based on currently logged in user

First of all, I’ve just recently started working with Algolia.

The title says a lot. Basically, I can get the correct results from the index (on page load) BUT I need to calculate/create and add to each record a new attribute (for each result hit - of Employees), based on which Employer (filters are built using Employer’s attributes) is logged in - so that I can rank by that NEW attribute.

The idea is to calculate the matching skills percentage (between what a logged in Employer and each of the Employees from the list have in their attribute called ‘‘skills’’) and add that info to each hit.

Is there a way to get the data from the index and somehow maybe (re)calculate one attribute for each of the retreived records?

Thanks in advance!

I’ve solved it. I ended:

  • creating a new attribute in my Index with value null
  • then, when I get the results on the frontend I just use transform-items function to go through retreived results
  • calculate what I need,
  • replace the null value with newly calculated one for each record (on the frontend!)
    and then I can do whatever I need (sort my results etc.)