Postgresql fulltext search for words with apostrop

2019-07-04 06:37发布

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条回答
登录 后发表回答