I have a rails 4 application with number of models and view pages. The application layout of my application contains a search bar. But it is inactive as of now. The purpose of search bar is to allow user to search through all the models for the keyword(s) entered, basically making it a global search. Is there any gem which does universal search? Or it has to be done manually through sql queries? I could see way to implement search for a specific model on its view page. But I want it to search through all the models at once. How should I go about it?
I think the best way in your case is to use ElasticSearch. A neat integration gem is provided here. Links to documentation are provided on that page.
One of the good approach for it will be to use gem 'searchkick'
which uses elasticsearch.
Resources for Searchkick: https://github.com/ankane/searchkick https://github.com/ankane/searchkick#advanced
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With