I have a database of restaurants where I perform a full-text search. The code looks something like this:
SELECT * FROM restaurant WHERE restaurant.search_vector @@ plainto_tsquery(:terms);
And is search_vectordefined as follows:
alter table restaurant add column search_vector tsvector;
create index restaurant_search_index on restaurant using gin(search_vector);
create trigger restaurant_search_update before update or insert on restaurant
for each row execute procedure
tsvector_update_trigger('search_vector',
'pg_catalog.english','title');
Now a notable problem with this search is the word barbecue. It can be written in different ways: barbecue, barbecue, barbecue, BBQ, BBQ, etc. When someone searches for any of them, I need to look for restaurants for all of these conditions.
From what I read on the Internet, it seems to me that I need to change the dictionary (it will pg_catalog.english, right?), But I'm not sure how to do it.
source
share