Multiple synonym dictionary matches in PostgreSQL full text searching

Posted by Ryan VanMiddlesworth on Stack Overflow See other posts from Stack Overflow or by Ryan VanMiddlesworth
Published on 2009-07-30T19:49:00Z Indexed on 2010/05/04 14:38 UTC
Read the original article Hit count: 473

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. But I've noticed that it apparently only allows a word to have one synonym. That is, 'al' cannot be 'albert' and '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;

What am I doing wrong? Thanks!

© Stack Overflow or respective owner

Related posts about sql

Related posts about full-text-search