2005-11-05T00:00:00Z

Ruby Text Search

I found some great Ruby code to assist in creating a simplistic search engine for your Rails app. It can be found on the Rails Wiki under TextSearch (http://wiki.rubyonrails.com/rails/pages/TextSearch). I recommend clicking on the “edit” button at the bottom to copy and paste the code out of the text field because some of the syntax gets lost on the page version. Just don’t click save :)

You may want to add ‘%!&(MISSING)rdquo; on either side of the search terms. This will increase results by returning words like “redesign” when the term “design” has been searched. There is also some code on the page to help search multiple keywords instead of phrases. This could be altered to act like Google where if you want to search by a phrase you encapsulate the phrase with quotes. You would then just do a check for quotes before breaking the words into an array.

Facebook Twitter Github Instagram Keybase