Problem with paginate search

Hi,

Firts all sorry for my poor english

I am doing a simple search with paginate, the problem is the search dont
find the words within acutes (example “dont find salón if i search
salon”).
Its the code for the seach:

def search
words = @params[‘search’].to_s.split(’ ‘)
array_conditions = []
for w in words
array_conditions = array_conditions + [“business LIKE ‘%#{w}%’”]
end
conditions = array_conditions.join(’ AND ')
@business_pages, @businesses = paginate :businesses, :per_page => 10,
:conditions => conditions
end

Thanks for you help

Jean Carlo Schechnner

Jean Carlo Schechnner <identidadvirtual@…> writes:

Hi,Firts all sorry for my poor englishI am doing a simple search with
paginate, the problem is the search dont find the words within acutes
(example
“dont find
salón if i search salon”). Its the code for the seach: def search words =
params[‘search’].to_s.split(’ ‘) array_conditions = [] for w
in words
array_conditions = array_conditions + [“business LIKE ‘%#{w}%’”] end
conditions = array_conditions.join(’ AND ')
business_pages, businesses = paginate :businesses, :per_page =>
10, :conditions => conditions endThanks for you helpJean Carlo
Schechnner

I don’t think this is a problem with your code… it’s probably because
the
database engine doesn’t think that ‘salón’ is LIKE ‘salon’.

BTW, this might be a bit more classic Ruby style:

def search
conditions = @params[‘search’].to_s.split(’ ‘).collect {|word|
“business LIKE
‘%#{word}%’”}.join(’ AND ')

Jean Carlo Schechnner wrote:

array_conditions = []
Jean Carlo Schechnner

This probably isn’t doesn’t to have anything to do with RoR but on how
the database is handling the query generated by the above code.

What database are you using?

It probably doesn’t think “salón” = “salon”

You will probably find its how the database handles the ‘LIKE’ search.

You might be able to configure your database differently to handle this.

Regards Neil.