Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Search to Ruby on Rails - Easy Question

I am trying to figure out how to add search to my rails application. I am brand new so go slow. I have created a blog and done quite a bit of customizing including adding some AJAX, pretty proud of myself so far. I am having trouble finding any good tutorials about how to add this functionality. Basically I just want to enable a full search to search my posts table. What is the easiest way to do this?

like image 418
bgadoci Avatar asked Feb 05 '26 12:02

bgadoci


2 Answers

There's a great Railscast on Thinking Sphinx, which is my favorite above the other mentioned options. It's fast, simple, and is continually being developed.

There's also SearchLogic which is great if you don't really need full text indexing (you probably don't for a blog). And a Railscast to go along with that as well.

like image 194
bensie Avatar answered Feb 07 '26 04:02

bensie


Depending on the RDBMS you are using there might be a built-in solution for fulltext search.

Otherwise you might check out Sunspot (and the Rails plugin) which uses Apache Solr for fulltext search and is easy to use. Especially writing queries/searches is much more fun than with the standard acts_as_solr plugin.

Edit Oh, and here is a screencast on Sunspot for the visual people.

like image 45
Marcel Jackwerth Avatar answered Feb 07 '26 03:02

Marcel Jackwerth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!