pg-search

PG full text search on rails using pg_search gem for substring

孤者浪人 提交于 2019-11-30 23:58:07
I am using Pg full text search for my search . As i am using Ruby on rails, I am using pg_search gem. How do i configure it to give a hit for substring as well. pg_search_scope :search_by_detail, :against => [ [:first_name,'A'], [:last_name,'B'], [:email,'C'] ], :using => { :tsearch => {:prefix => true} } Right now it gives a hit if the substring is in the start but it wont give a hit if the substring in the middle example It gives a hit for sdate@example.com but not for example.com I'm the author and maintainer of pg_search. Unfortunately, PostgreSQL's tsearch by default doesn't split up

How to configure a pg_search multisearch on associated models in Rails?

感情迁移 提交于 2019-11-30 07:28:32
I'm adding pg_search into a Rails app. I'm not completely understanding the configuration, and would appreciate a gentle nudge in the right direction. First, I already have a multi model site more or less set up and running on my app. But I want to extend it to also search on associated models. For example, I have Manufacturer, Car, Model classes. Currently if I search for "Ford", only the manufacturer is returned. I'd also like to return all the associated Cars (which belong to Manufacturer) and Models (which belong to Car). I can see how to do this as a scoped search class Car pg_search