Postgresql fulltext search for words with apostrophes
Asked Answered
C

0

6

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

Cloak answered 14/2, 2011 at 22:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.