Hi,
How do you use Tsearch2 in Rails?
Petr
Hi,
How do you use Tsearch2 in Rails?
Petr
i had a classifieds table with 2 columns (title and description) that i
wanted to include in my search. Here is how i created it
then in my model did this passing in search terms as a parameter
def self.fs_search(q)
ts_query = q.gsub(/[\s+]/,’&’)
self.find_by_sql([“select * from classifieds where search_idx @@
to_tsquery(‘default’,?)”,ts_query])
end
good luck.
Adam
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs