I'm using pg_search for some text searching within my model. Among other attributes, I have an url
field.
Unfortuantelly Postgres doesn't seem to identify /
and .
as word separators, therefore I cannot search within the url
.
Example: searching for test
in http://test.com yields no results.
Is there a way to fix this problem, perhaps using another gem or some inline SQL ?
I ended up modifying the pg_search gem to support arbitrary ts_vector expressions instead of just column names. The changes are here
Now I can write:
pg_search_scope :search,
against: [[:title , 'B'], ["to_tsvector(regexp_replace(url, '[^\\w]+', ' ', 'gi'))", 'A']],
using: {tsearch: {dictionary: "simple"}}