Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add synonyms custom dictionary to Amazon RDS for PostgreSQL

I have a database of products which I do a full-text search on using pg_search Gem. The query looks something like this:

SELECT "products".* FROM "products" WHERE (((to_tsvector('english', coalesce("products"."description"::TEXT, ''))) @@(to_tsquery('english', ''' ' || 'purchase' || ' '''))));

As I am doing a Full-text search, I want to add the search functionality for following

  1. Synonyms search eg. words purchase, buy, acquire, obtain
  2. Near By words eg. words (table, chair) or (pen, Pencil, Eraser)
  3. Spelling mistake

Now, a notable problem with this search is, when somebody searches any of these, I need to search products for all of these terms(synonyms and near by word and spelling mistake).

But it seems we need to give the synonyms dictionary as input to have this kind of search functionality. How to add custom dictionary to PostgreSQL? Even if we manage to add synonyms dictionary to postgresql, How can we add this to my AWS RDS (Amazon RDS for PostgreSQL) database?

Refer link for synonyms: http://shisaa.jp/postset/postgresql-full-text-search-part-2.html

like image 531
Shankar Shinde Avatar asked May 19 '15 06:05

Shankar Shinde


1 Answers

According to this thread, it's not possible at the moment (2020).

Unfortunately, because RDS doesn't provide filesystem access, you won't be able to upload your custom files to $SHAREDIR.

like image 141
Benoit Blanchon Avatar answered Nov 15 '22 04:11

Benoit Blanchon