I'm using the pg_search gem in a Rails app to search against users - their bios and associated skill model. Users are developers, so their skills include things like "CSS", "C++", "C#", "Objective C", etc...
I was initially using the the following search scope:
pg_search_scope :search,
against: [:bio],
using: {tsearch: {dictionary: "english", prefix: true}},
associated_against: {user: [:fname, :lname], skills: :name}
However, if you search "C++" in this case, you'd get results that included "CSS" (among other things). I changed the scope to use the "simple" dictionary and removed prefixing:
pg_search_scope :search_without_prefix,
against: [:bio],
using: {tsearch: {dictionary: "simple"}},
associated_against: {user: [:fname, :lname], skills: :name}
This fixed some things - for example, searching "C++" doesn't show "CSS". But, searching "C++" or "C#" still matches users who have "C" or "Objective C" listed
I can definitely do a basic ILIKE
match, but hoping to accomplish this using pg_search if possible.