Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails - Search Controller

I'm getting ready to build search capabilities into my app. I want the search to have the ability to span multiple models.

I'm thinking about adding a search controller which would then decide which models to search based on settings etc...

What do you think? Does a search controller sound right or is there something open-source I should be thinking about?

Thanks

like image 293
AnApprentice Avatar asked Jan 21 '23 05:01

AnApprentice


1 Answers

You have a couple of options for search in ruby world like

  1. Sphinx
  2. Ferret
  3. Solr
  4. Endeca

Going through the documentation of heroku, heroku suggests with solr which is an awesome search engine. http://docs.heroku.com/websolr and http://docs.heroku.com/full-text-search details more information about that. We chose solr for search in one of our projects and we used sunspot_rails which nicely integrates with your models and reindexes when your content changes. We used the gem sunspot_rails from http://github.com/outoftime/sunspot which is recommended by heroku too.

Caveat though is that heroku's file system is read only and does not allow you to run arbitrary processes, so you have to choose one like websolr(starts from 20$ a month) or spawning your own amazon ec2 instance and do the indexing there. Since heroku is also running on amazon ec2, the latency is very very less.

Getting back to the alternatives, Ferret is known to crash/corrupt indexes often in production. Sphinx is not supported by heroku. Endeca is damn expensive, you gotta spend most of your budget just even to get basic results.

like image 188
Kunday Avatar answered Jan 29 '23 08:01

Kunday