Forum: Ruby on Rails RE: Help with TextSearch :all and MySQL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-01-06 20:03
(Received via mailing list)
Duane J. wrote:
> If that doesn't work, can  you help me understand what's happening
> (or not happening), e.g. logs or otherwise?  It might help if you
> could send some query strings to the log, too--just to see what it's
> doing underneath.

Duane,

Thanks for responding!

Removing 'searches_on' all together didn't work. It gives this error:

-----------------------------------
 ArgumentError in Foobar#search

 wrong number of arguments (1 for 0)

 RAILS_ROOT: ./script/../config/..
 Application Trace | Framework Trace | Full Trace

 #{RAILS_ROOT}/lib/search.rb:18:in `type'
 #{RAILS_ROOT}/lib/search.rb:18:in `searchable_fields'
 #{RAILS_ROOT}/lib/search.rb:18:in `select'
 #{RAILS_ROOT}/lib/search.rb:18:in `searchable_fields'
 #{RAILS_ROOT}/lib/search.rb:55:in `search'
 #{RAILS_ROOT}/app/controllers/foobar_controller.rb:58:in `search'
-----------------------------------

The only query showing my MySQL query log from this error is:

 SHOW FIELDS FROM foobar

When I specify the fields for searches_on, the query log shows the
additional query:

 SELECT * FROM foobar WHERE ((UCASE(title) LIKE '%SEARCHSTRING%' OR
UCASE(name) LIKE '%SEARCHSTRING%' OR UCASE(blah) LIKE '%SEARCHSTRING%'

If it matter, I'm using MySQL 5.0. But I don't think that should matter
here.

Thank you Duane.

   Matt

--
Matt C. Wagner
Information Security Analyst

Network Intrusion Detection
Security Operations Center
Corporate Information Security
Wells Fargo Bank
Duane J. (Guest)
on 2006-01-06 20:33
(Received via mailing list)
On Jan 6, 2006, at 11:02 AM, <removed_email_address@domain.invalid>
<removed_email_address@domain.invalid> wrote:

> Removing 'searches_on' all together didn't work. It gives this error:
>  #{RAILS_ROOT}/lib/search.rb:18:in `searchable_fields'
> When I specify the fields for searches_on, the query log shows the
> additional query:
>
>  SELECT * FROM foobar WHERE ((UCASE(title) LIKE '%SEARCHSTRING%' OR
> UCASE(name) LIKE '%SEARCHSTRING%' OR UCASE(blah) LIKE '%SEARCHSTRING%'
>

Is it causing an error because of the lack of closing parens?

> If it matter, I'm using MySQL 5.0. But I don't think that should
> matter
> here.
>
Not sure.  I don't think so either, though.  Nothing special going on
in the query.

Just to make sure we're on the same page, I've attached the latest
search.rb file that I have.  I think it's slightly different from the
one you're using, because the error wasn't on the same line.  Could
you check this one?

Duane J.
(canadaduane)
http://blog.inquirylabs.com/
This topic is locked and can not be replied to.