Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 带Postgres的Rails全文搜索_Postgresql_Ruby On Rails 4 - Fatal编程技术网

Postgresql 带Postgres的Rails全文搜索

Postgresql 带Postgres的Rails全文搜索,postgresql,ruby-on-rails-4,Postgresql,Ruby On Rails 4,我一直在努力让全文搜索工作。我想要一个像“索尼音箱”这样的搜索词来检查我的产品型号上的两个字段。其中一个字段称为manufacturer,另一个字段称为description 我试过这个 product.where('manufacturer @@ :q or description @@ :q', q: term) 我希望它检查制造商或描述中是否存在索尼或扬声器,并返回记录

我一直在努力让全文搜索工作。我想要一个像“索尼音箱”这样的搜索词来检查我的产品型号上的两个字段。其中一个字段称为manufacturer,另一个字段称为description

我试过这个

product.where('manufacturer @@ :q or description @@ :q', q: term)
我希望它检查制造商或描述中是否存在索尼或扬声器,并返回记录