Received: from maia.hub.org (maia-1.hub.org [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 19A9963346E; Thu, 29 Apr 2010 14:48:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 68698-06; Thu, 29 Apr 2010 17:48:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp5.tech.numericable.fr (smtp5.tech.numericable.fr [82.216.111.41]) by mail.postgresql.org (Postfix) with ESMTP id 4DB3A63330B; Thu, 29 Apr 2010 14:48:32 -0300 (ADT) Received: from [10.0.1.2] (abo-102-217-68.trs.modulonet.fr [85.68.217.102]) by smtp5.tech.numericable.fr (Postfix) with ESMTP id 3F77C12402F; Thu, 29 Apr 2010 19:48:29 +0200 (CEST) Cc: "sandeep prakash dhumale" , pgsql-sql@postgresql.org, pgsql-general@postgresql.org Message-Id: <4D5A9366-9110-4FA4-8445-E408E2C2FEE9@numericable.fr> From: John Gage To: Tom Lane In-Reply-To: <10739.1272549691@sss.pgh.pa.us> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: [SQL] Tsearch not searching 'Y' Date: Thu, 29 Apr 2010 19:48:29 +0200 References: <20100429131340.25498.qmail@f4mail-235-146.rediffmail.com> <10739.1272549691@sss.pgh.pa.us> X-Mailer: Apple Mail (2.936) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.51 tagged_above=-10 required=5 tests=BAYES_05=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/1094 X-Sequence-Number: 162292 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" 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@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql