How to combine results from correlated multi-index search using Vue instantSearch 1.7.0

I’m working on a personal Netflix style streaming site using Laravel 5.6 (with Laravel Scout), Vue 2.5.7, and Algolia with Vue InstantSearch version 1.7.0. I have two MySQL tables, ‘movies’ and ‘shows’. At times in my application I want to be able to search on both indices at the same time and combine the results into one result widget. I’m not sure how to do this. I’ve seen the code in the docs about a correlated multi-index search, but the results are treated as separate in that example. For some things, like the user’s watch history, I want the movies and TV shows combined and sorted in order of when they were last watched.

My first thought on how to do this was to make a MySQL view that combines the movies and shows tables and make an index off of that view. I managed to do this, but it feels hacky to me. Is there a better way to organize this?

Hello there,

Creating an index that combines both movies and shows seems the best solution to me, as it would need a single call to retrieve the search results instead of two when using multi-index search. You would need to update the last view field of each record and make sure to include this field in ranking formula in the index settings.

Hope this helps!