Postgresql fulltext search for words with apostrophes

喜你入骨 提交于 2019-12-12 12:28:12

问题


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"?

来源:https://stackoverflow.com/questions/4997943/postgresql-fulltext-search-for-words-with-apostrophes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!