Search all models gem
I have seen this done in other rails application where you can search for a term and it would search across multiple models and return results from each. What is the best gem to use for this purpose?
Is there a episode in GoRails for Searching and Filtering?
Regards,
Ali
Searchkick with Elasticsearch is pretty good for searching models and is very flexible. It's my go-to solution with searching.
Here's an episode on Searchkick
https://gorails.com/episodes/elasticsearch-with-searckick?autoplay=1
You could also look into using Ransack I believe is another popular gem for it.
Like Andrew said, Searchkick is perfect for this. Each model gets an index inside ElasticSearch and then searchkick lets you query over those by simply doing this: https://github.com/ankane/searchkick#multiple-indices All that should make sense after watching the screencast. 😎
Ransack isn't quite the same in that it doesn't index them in a way that you could search multiple models together. You'd actually have to search each table separately and then combine the results in your view. It's nothing fancy as it just does database queries which makes it really easy to implement without any separate services, but more rudimentary in a sense.