Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id BB64A63258B for ; Wed, 7 Jul 2010 19:57:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 65760-01 for ; Wed, 7 Jul 2010 22:57:35 +0000 (UTC) X-Greylist: delayed 00:13:18.923208 by SQLgrey-1.7.6 Received: from sn.sai.msu.ru (sn.sai.msu.ru [195.208.220.215]) by mail.postgresql.org (Postfix) with ESMTP id 1AA17632311 for ; Wed, 7 Jul 2010 19:57:35 -0300 (ADT) Received: from sn.sai.msu.ru (localhost [127.0.0.1]) by sn.sai.msu.ru (8.14.1/8.12.8) with ESMTP id o67MiCuG006457; Thu, 8 Jul 2010 02:44:12 +0400 Received: from localhost (megera@localhost) by sn.sai.msu.ru (8.14.1/8.12.8/Submit) with ESMTP id o67MiBTk006454; Thu, 8 Jul 2010 02:44:12 +0400 X-Authentication-Warning: sn.sai.msu.ru: megera owned process doing -bs Date: Thu, 8 Jul 2010 02:44:11 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@sn.sai.msu.ru To: Peter Koczan cc: pgsql-sql@postgresql.org Subject: Re: tsearch2 and wildcards/pattern matching? In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.1 tagged_above=-5 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201007/39 X-Sequence-Number: 34352 it's called prefix search: =# select 'zvt123456'::tsvector @@ 'zvt:*'; ?column? ---------- t On Wed, 7 Jul 2010, Peter Koczan wrote: > Hi all, > > Is there any sort of pattern matching or partial matching capability > in tsearch2? > > I'd like to be able search for a common prefix (like for order > numbers). For instance, tsearch2 will index 'zvt123456' or > 'zvt555555', but I'd like to be able to find both of them in one query > using something akin to 'zvt%', like > > select * from attachments where textsearchable @@ 'zvt%'; > > I've been unable to find anything in documentation. If there's > anything in tsearch2 that can do this and is faster than LIKE clauses > on full-text, that would be fantastic. > > Cheers, > Peter > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83