sorry for making you access the link.. :) i am interested in this too .. so if you find something please let me know
Laravel Scout + Algolia - Global Search on Multiple Entities
Hi there.
As the title suggests, I'm attempting to create a global search function that will search across multiple entities. I'll be using Algolia as the search engine and I figured Scout would be perfect for interaction with that. At least on the indexing.
Now the tricky part is how do I query on multiple entities. I guess I have a few options, but I'm struggling to see one clear strategy that will do it well.
I could just do the query on multiple entities and merge the results, but I'd want to sort by relevance, and as far as I can see there's no way to get the relevance through Scout, you just get the entity. Is that correct?
So maybe I need to avoid using Scout for the retrieval of records. But then should I use a single index for all entities? Can I specify multiple indexes to Scout so I index on an entity-specific index and a global index? Should I perform multiple searches through Algolia and attempt to merge and hydrate the results manually so as to keep access to the relevance/ranking information?
It feels like a bit of a rabbit hole and one that could get messy (sorry for the mixed metaphors!). I'm sure this someone must have done before and done in a more elegant and complete way than I've currently got in my head!
Thanks!
Please or to participate in this conversation.