I am trying to do full-text searching in PostgreSQL 8.3. It worked splendidly, so I added in synonym matching (e.g. 'bob' == 'robert'
) using a synonym dictionary. That works great too.
However, I've noticed that it apparently only allows a word to have one synonym. That is, al
cannot be albert
or allen
.
Is this correct? Is there any way to have multiple dictionary matches in a PostgreSQL synonym dictionary?
For reference, here is my sample dictionary file:
bob robert
bobby robert
al alan
al albert
al allen
And the SQL that creates the full text search config:
CREATE TEXT SEARCH DICTIONARY nickname (TEMPLATE = synonym, SYNONYMS = nickname);
CREATE TEXT SEARCH CONFIGURATION dxp_name (COPY = simple);
ALTER TEXT SEARCH CONFIGURATION dxp_name ALTER MAPPING FOR asciiword WITH nickname, simple;
Synonyms: any , a few, several , a number, an amount, a certain amount, a part, a portion, a good few, a fair few. Sense: Adjective: few. Synonyms: a few, a little , a bit, part of, more than a few, more than a little, any , several , various.
Opposite of used or performed by a number of people as a group. exclusive. individual. single. singular.
That's a limitation in how the synonyms work. What you can do is turn it around as in:
bob robert
bobby robert
alan al
albert al
allen al
It should give the same end result, which is that a search for either one of those will match the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With