Search Postgresql Archives

websearch_to_tsquery() and apostrophe inside double quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am a little confused about what us being generated by websearch_to_tsquery() in the case of an apostrophe inside double quotes.

Here is an example of searching for a name containing an apostrophe.

The following works as expected:

select to_tsvector('peter o''toole') @@ websearch_to_tsquery('peter o''toole');
 ?column?
----------
 t
(1 row)


When the name is in double quotes, the search fails:

select to_tsvector('peter o''toole') @@ websearch_to_tsquery('"peter o''toole"');
 ?column?
----------
 f
(1 row)

In the first case, websearch_to_tsquery() returns:

select websearch_to_tsquery('peter o''toole');
  websearch_to_tsquery  
------------------------
 'peter' & 'o' & 'tool'
(1 row)

which makes sense to me.

In the second case websearch_to_tsquery() returns something that I can't quite understand:

select websearch_to_tsquery('"peter o''toole"');
     websearch_to_tsquery    
------------------------------
 'peter' <-> ( 'o' & 'tool' )
(1 row)

I am not quite sure what text this will actually match?

Best regards,

Alastair



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux