开发者

Postgresql fulltext search for words with apostrophes

开发者 https://www.devze.com 2023-02-10 05:56 出处:网络
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 i

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

0

精彩评论

暂无评论...
验证码 换一张
取 消