views:

26

answers:

2

Hello. 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

+1  A: 

I would say avoid rolling your own search "engine" unless you have a very specific need that cannot be met by something like Sphinx (also read this)

Zabba
Thanks. I had never heard of Sphinx, sounds amazing. Sadly Heroku doesn't support Sphinx. Must be there method to get your to pay for their $$$ search services.
AnApprentice
You might find this helpful too: http://stackoverflow.com/questions/2166378/are-there-other-search-options-for-heroku
Zabba
+2  A: 

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.

Kunday