Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 503D6632DB8 for ; Wed, 1 Sep 2010 05:44:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 61306-08 for ; Wed, 1 Sep 2010 08:44:31 +0000 (UTC) X-Greylist: from auto-whitelisted 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 1B147632C84 for ; Wed, 1 Sep 2010 05:44:30 -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 o818iS7g012981; Wed, 1 Sep 2010 12:44:28 +0400 Received: from localhost (megera@localhost) by sn.sai.msu.ru (8.14.1/8.12.8/Submit) with ESMTP id o818iSPC012978; Wed, 1 Sep 2010 12:44:28 +0400 X-Authentication-Warning: sn.sai.msu.ru: megera owned process doing -bs Date: Wed, 1 Sep 2010 12:44:28 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@sn.sai.msu.ru To: Erik Rijkers cc: pgsql-docs@postgresql.org Subject: Re: prefix search in tsearch 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=-2.6 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201009/3 X-Sequence-Number: 5993 Erik, I think it'd be more clear if you say not 'stemmed', but processed in according to configuration. Here is an example: $SHAREDIR/tsearch_data/my_synonyms.syn contains one line: one 1 CREATE TEXT SEARCH DICTIONARY my_synonym ( TEMPLATE = synonym, SYNONYMS = my_synonyms ); ALTER TEXT SEARCH CONFIGURATION english ALTER MAPPING FOR asciiword WITH my_synonym, english_stem; test=# select 'one'::tsvector @@ to_tsquery('english','one:*'); ?column? ---------- f (1 row) because 'one' was processed by my_synonym dictionary. test=# select ts_debug('english','one'); ts_debug ------------------------------------------------------------------------------ (asciiword,"Word, all ASCII",one,"{my_synonym,english_stem}",my_synonym,{1}) (1 row) On Tue, 31 Aug 2010, Erik Rijkers wrote: > [docs from cvs HEAD] > > I found the text-search documentation a little unclear about 'prefix search'; specifically, the > examples do not show that the so-called 'prefix' is first stemmed, before it is used as prefix. > > For instance, the following can be a little surprising: > > SELECT to_tsvector( 'postgraduate' ) @@ to_tsquery( 'postgres:*' ); > ?column? > ---------- > t > (1 row) > > Because prefix search is such an important functionality I think this should be better explained, > which I hope the attached doc-patch does. > > (In textsearch.sgml is another mention + example of prefix search, perhaps it should be extended a > little there too - which I'm happy to do as well, but I first wanted to see if you agree that it > is a little too obscure as it stands) > > > Erik Rijkers > 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