Re: [SQL] Tsearch not searching 'Y'

From: John Gage <jsmgage(at)numericable(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "sandeep prakash dhumale" <sandy9940(at)rediffmail(dot)com>, pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] Tsearch not searching 'Y'
Date: 2010-04-29 17:48:29
Message-ID: 4D5A9366-9110-4FA4-8445-E408E2C2FEE9@numericable.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

You can avoid stemming by using 'simple' instead of 'english' as the
language of the words in to_tsvector (which is a little more awkward
than the cast).

"There are no stop words for the simple dictionary. It will just
convert to lower case, and index every unique word.
SELECT to_tsvector('simple', 'Andy andy The the in out');
to_tsvector
-------------------------------------
'in':5 'out':6 'the':3,4 'andy':1,2
(1 row)

John

On Apr 29, 2010, at 4:01 PM, Tom Lane wrote:

> "sandeep prakash dhumale" <sandy9940(at)rediffmail(dot)com> writes:
>> I am trying to get tsearch working for my application but I am
>> facing a
>> problem when alphabet 'Y' is the in the tsquery.
>
>> # SELECT 'hollywood'::tsvector @@ to_tsquery('holly:*');
>> ?column?
>> ----------
>> f
>> (1 row)
>
> You can't use to_tsquery for this sort of thing, because it tries to
> normalize the given words:
>
> regression=# select to_tsquery('holly:*');
> to_tsquery
> ------------
> 'holli':*
> (1 row)
>
> If you do this it works:
>
> regression=# SELECT 'hollywood'::tsvector @@ 'holly:*'::tsquery;
> ?column?
> ----------
> t
> (1 row)
>
> So if you want to use prefix matching, don't normalize.
>
> regards, tom lane
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Wall 2010-04-29 17:51:53 Re: Storing many big files in database- should I do it?
Previous Message Jorge Arevalo 2010-04-29 17:45:41 Re: Writing SRF

Browse pgsql-sql by date

  From Date Subject
Next Message DM 2010-04-30 00:06:45 Re: problem converting strings to timestamps with time zone
Previous Message sandeep prakash dhumale 2010-04-29 14:14:10 Re: Re: [GENERAL] [SQL] Tsearch not searching 'Y'