Best way to add additional information to search result /recommendation search result
I am being cognizant on performance aspect and currently unable to make a decision. I know with coveo there are lot of ways of adding info we need.
1. Computed fields - Not possible in my use case as this is time sensitive data and need to be latest at all times and comes from API OR is heavily context driven meaning based on user or location for instance it changes
2. Modify and add all the attributes we need on the result via this pipeline - https://docs.coveo.com/en/616/coveo-for-sitecore-v4/altering-search-results-before-they-are-displayed-in-a-search-interface
Seems doable, but, worried on performance since we need bunch of calls and business logic to run to gather all details we would need to be displayed on the view.
3. Typical helper firing on Coveo view getting what we need per element of concern - This way we let the rendering load and not block the whole request. But, here we break the MVC pattern and load the view with lot of code.
Is there a hidden another way that I am not thinking of may be a middle approach of #2 and #3? Let me know your thoughts
I think I would try approach #2. Say you ensure that your custom logic is only applied for the Recommendation component, or only to a type of result, and that you have the default 10 results per page, it would execute 10 calls to your service per query, which I don't think is _that_ much for your service.
Else I would try to show temporary, estimated data from the index in the result template, but update it asynchronously once the real data is ready.
There is no magic way here, it looks like you need "near-real-time" data couple with index data, so you have to mix them up in some way!