Help with Model find

I am trying to set up a simple search on my site. First I am grabbing
the string that was entered into the text field and searching through
my article titles.

Next I am splitting the string into an array so i can separate the
search string into individual keywords. What I would like to do now
is loop through that array of keywords and pull in any articles where
the body text contains the keyword.

I have been testing this in the console for my app. So far it looks
like the SQL query is correct but no articles are being added to my
array of articles.

here is a copy of my search action code:

def search
# Collect full query from params, then search article titles for a
match on the full query string
@query = params[:query]
by_title = Article.find(:all, :conditions => [ “active = ? AND
title like ?”, true, “%#{params[:query]}%” ])
# Split the query string into an array of keywords based on
keywords = @query.split(/\s+/)
by_keyword = []
keywords.each { |term| by_keyword | Article.find(:all, :conditions
=> [ “active = ? AND body LIKE ?”, true, “%#{term}%” ]) }
@articles = by_title | by_keyword

Does anyone have any suggestions?

Have you thought about using Ferret and the acts_as_ferret plugin?

I have thought about that but I think that is going to be a little
while down the road. We’re trying to launch by next week so for now
we’re just trying to come up with a simple search.