Postgresql 全文搜索带撇号的单词
我正在为 Postgresql 8.4 构建一个定制的 ispell 字典配置,并且在正确解析带有撇号的单词时遇到一些问题。 Postgresql 中包含的 ispell 字典包含一个 .affix 文件,其中包含一个“M”SFX 规则,该规则指定其单词的扩展形式。
这是一个示例,假设我的字典文件中有 dictionary/SM
:
SELECT to_tsvector('english_ispell', 'dictionary''s dictionaries');
预期输出:
'dictionary':1,2
实际输出:
s':2, 'dictionary':1,3
我做错了什么吗?这是 ts_debug 的输出,显示其解析方式。
SELECT * FROM ts_debug('english_ispell', 'dictionary''s dictionaries');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-----------------+--------------+-------------------------------+----------------+--------------
asciiword | Word, all ASCII | dictionary | {english_ispell,english_stem} | english_ispell | {dictionary}
blank | Space symbols | ' | {} | |
asciiword | Word, all ASCII | s | {english_ispell,english_stem} | english_ispell | {s}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | dictionaries | {english_ispell,english_stem} | english_ispell | {dictionary}
如何让 Postgresql 将 '
解析为单个单词的一部分而不具有它分解为“空间符号”?
I'm working on building a customized ispell dictionary configuration for Postgresql 8.4 and am having some problems getting words with apostrophes in them to parse correctly. The ispell dictionaries included with Postgresql include an .affix files which contains a "M" SFX rule which specifies an expanded form of its word.
Here is an example, assuming that I have dictionary/SM
in my dictionary file:
SELECT to_tsvector('english_ispell', 'dictionary''s dictionaries');
Expected output:
'dictionary':1,2
Actual ouput:
s':2, 'dictionary':1,3
Am I doing something incorrectly? Here is the output from ts_debug to show how its being parsed.
SELECT * FROM ts_debug('english_ispell', 'dictionary''s dictionaries');
alias | description | token | dictionaries | dictionary | lexemes
-----------+-----------------+--------------+-------------------------------+----------------+--------------
asciiword | Word, all ASCII | dictionary | {english_ispell,english_stem} | english_ispell | {dictionary}
blank | Space symbols | ' | {} | |
asciiword | Word, all ASCII | s | {english_ispell,english_stem} | english_ispell | {s}
blank | Space symbols | | {} | |
asciiword | Word, all ASCII | dictionaries | {english_ispell,english_stem} | english_ispell | {dictionary}
How do I get Postgresql to parse the '
as part of a single word and not have it broken up as a "space symbol"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论