RE: Help with TextSearch :all and MySQL


#1

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:insearchable_fields’
#{RAILS_ROOT}/lib/search.rb:18:in select' #{RAILS_ROOT}/lib/search.rb:18:insearchable_fields’
#{RAILS_ROOT}/lib/search.rb:55:in search' #{RAILS_ROOT}/app/controllers/foobar_controller.rb:58:insearch’

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


#2

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/