Simply add attributes to hits after search and update the result?


I am setting up InstantSearch for products of a webshop with the plain JavaScript implementation, but I am running into the problem that we have prices specific to customer groups (and I don’t want to have multiple search indexes for each group and the data is sensitive), and things like live stock information (need to do another API call for that).

These attributes I would like to ideally load after getting search results, from our own back-end.

I thought it would simply be a matter of manipulating the search results after receiving them and rerendering only the front-end (without calling the API again for new results).

This is a bit tricky. transformItems is possible, but I want to already display the results and load the other data into the hit templates after, not before displaying the results. Also it seems to fire twice on every query.

So I end up with a custom widget, and I can access and manipulate the results there, but here the problem is that I don’t know how to reflect these changes into the rendered templates.

The data is changed, but the templates do not.

So how could I trigger a rerender, without triggering a new search query (resulting in new, unmanipulated hits)?