Re: [SQL] Tsearch not searching 'Y'

From: Kenneth Marshall <ktm(at)rice(dot)edu>
To: sandeep prakash dhumale <sandy9940(at)rediffmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] Tsearch not searching 'Y'
Date: 2010-04-29 13:56:02
Message-ID: 20100429135602.GM1610@aart.is.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Thu, Apr 29, 2010 at 01:13:40PM -0000, sandeep prakash dhumale wrote:
> Hello All,
>
> I am trying to get tsearch working for my application but I am facing a
> problem when alphabet 'Y' is the in the tsquery.
>
> can anyone please share some light on it.
>
>
> # SELECT 'hollywood'::tsvector @@ to_tsquery('holly:*');
> ?column?
> ----------
> f
> (1 row)
>
> SELECT 'hollywood'::tsvector @@ to_tsquery('holl:*');
> ?column?
> ----------
> t
> (1 row)
>
>
> It works when i put &lt;&gt; in y as below but i don't want to do it that way.
>
> SELECT 'hollywood'::tsvector @@ to_tsquery('holl&lt;y&gt;:*');
> ?column?
> ----------
> t
>
> Thanks in advance

That is because the to_tsquery() normalizes the tokens. Here is
what I get from the default configuration:

db=# select to_tsquery('holly:*');
to_tsquery
------------
'holli':*
(1 row)

db=# select to_tsquery('holl:*');
to_tsquery
------------
'holl':*
(1 row)

It is pretty easy to see why you see the behavior that you do.
Maybe you need to change your tsearch configuration to match what
you expect to happen.

Regards,
Ken

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-04-29 13:56:14 Re: Writing SRF
Previous Message Geoffrey Myers 2010-04-29 13:55:46 using between with dates

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2010-04-29 14:01:31 Re: Tsearch not searching 'Y'
Previous Message sandeep prakash dhumale 2010-04-29 13:13:40 Tsearch not searching 'Y'