我正在PostgreSQL 8.3中进行全文搜索。它工作出色,所以我添加同义词匹配(例如'bob'=='robert')使用同义字典。那也很好。但是我注意到,它显然只允许一个单词具有一个同义词。也就是说,'al'不能是'albert'和'allen'。
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'.
这是正确的吗?有没有办法在PostgreSQL同义词字典中有多个字典匹配?
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创建全文搜索配置的SQL:
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;我做错了什么?谢谢!
推荐答案这是同义词工作的一个限制。你可以做的是如下:
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.
更多推荐
多个同义字典匹配PostgreSQL全文搜索
发布评论