From: Frederick Cheung Date: 2007-12-30T09:00:40+09:00 Subject: Re: String highlighting problem (newbie) On 29 Dec 2007, at 19:11, Mark Toth wrote: > Thanks for your answer. > > I have now used the following for the 1.: > > a1 = "+" > a2 = "*" > @searchstring = params[:searching].gsub(" ", "* +") > @results = Product.find_by_sql("SELECT * FROM products WHERE MATCH > (name,sku) AGAINST ('"+a1+@searchstring+a2+"' IN BOOLEAN MODE) order > by > name desc LIMIT 0,50;") > > It works, BUT not for numbers. Any idea why it coesn´t work for > numbers? > If I have example: "this is 34" in the database. It works fine "this > is", but as soon as I enter the "34" it shows no results. > Does it work for longer numbers? By default mysql won't index words less than 3 characters or so (check the doc) there are also stopwords etc... Fred > > > About 2: > > Brute force method? - What do you mean by this? > > ar = @string.split(' ') > ar[1] = "#{ar[1]}" > ar[3] = "#{ar[3]}" > @string = ar.join(' ') > > > -- > Posted via http://www.ruby-forum.com/. >