I am building an application where I added a Full Text Search feature using PostgreSQL's built in FTS. The app lists Mutual Funds in India. In some cases, mutual fund companies get acquired and their name changes. I wanted to allow people to search using the old names in case they were not aware of the change. So for instance, when DHFL funds got acquired by PGIM, all funds were renamed from DHFL to PGIM.
To achieve this, I created a synonym dictionary where I added PGIM as a synonym for DHFL.
However, I discovered that this simply replaces DHFL with PGIM. Which means that some older funds, which still retain the name of DHFL, are no longer returned in my query with the word dhfl.
Is there an option where a synonym adds a word rather than replace it, such that DHFL searches for both DHFL and PGIM?
Copyright Notice:Content Author:「gouravkr」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/61413873/create-synonym-dictionary-to-add-instead-of-replace-words-in-postgresql