Filter Algolia search result by external data

  algolia, javascript, jquery

I am using Algolia vanilla instantsearch.js to get the results of a search on a Laravel 5.4 platform.

Now i am doing a prefered result feature where an use can save to db some of the records retreived by search. Until i have to select a record an save it it is ok and in the search page i can load an array with the IDs of records saved by user.

I need now a function to change the class of a record if it is in the preferred IDs array, something like:

if(in_array(,IDs_array) change css class...

and i am using this Jquery function:

$(".myclass").each(function() {

But i am stuck because this function doesn’t find the Algolia records.

So, i am asking, when the Algolia instantsearch results are loaded into document and how can i get them?

Source: Ask Javascript Questions