I'm following the Railscasts #343 Full-Text Search in PostgreSQL, and at the beggining I get a problem.
I replace this line in my modele :
where("name ilike :q or content ilike :q", q: "%#{query}%")
by
where("name @@ :q or content @@ :q", q: query)
But, it still don't perform the search as he can in the railscasts. If in the name I have "FOO", and in the content "BAR", and if I search "FOO BAR" the result is empty. (Like with the old code and the "ilike" function)
The SQL request look like that :
* FROM "posts" where (name @@ 'foo bar' or content @@ 'foo bar')
I'm using PostgreSQL 9.2.2 , Rails 3.2.6 and Ruby 1.9.3p125 on Windows 7 x64.
Thanks by advance.
EDIT
My Gem file :
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'pg'
gem "ransack"
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I removed all commented line.
PS: Just to be clear, before I add "ransack", I had the same problem.