Received: from trade-india.com (unknown [130.94.20.28]) by postgresql.org (Postfix) with SMTP id 33FA0475ACA for ; Sat, 23 Feb 2002 01:22:24 -0500 (EST) Received: (qmail 11037 invoked from network); 23 Feb 2002 06:27:07 -0000 Received: from ptil-235-129-del.primus-india.net (HELO trade-india.com) (203.196.129.235) by 130.94.22.209 with SMTP; 23 Feb 2002 06:27:07 -0000 Message-ID: <3C7735D6.7E87781A@trade-india.com> Date: Sat, 23 Feb 2002 11:55:26 +0530 From: Rajesh Kumar Mallah X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: "Samuel J. Sutjiono" , pgsql-sql@postgresql.org Subject: Re: Regular Expression for 'and' instead of 'or' References: <023101c1bbc3$03a33910$110a010a@headquarters.wcgroup.com> Content-Type: multipart/alternative; boundary="------------12F2472176ED16E07558E0C0" X-Archive-Number: 200202/335 X-Sequence-Number: 6757 --------------12F2472176ED16E07558E0C0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit How about using the contrib/tsearch module that uses gist indexes. moreover it has builtin support for word stemming,morphology and stuff. (to my knowledge) you would ofcourse require to upgrade to PGSQL7.2 excrepts from README.tsearch contrib module. ================ and now you can search all titles with words 'patch' and 'gist': select title from titles where titleidx ## 'patch&gist'; Here, ## is a new operation defined for type 'txtidx' which could use index (if exists) built on titleidx. This operator uses morphology to expand query, i.e. ## 'patches&gist' will find titles with 'patch' and 'gist' also. If you want to provide query as is, use operator @@ instead: select title from titles where titleidx @@ 'patch&gist'; "Samuel J. Sutjiono" wrote: > This expression matches the word socks or shoes or nike in product > categorywhere productdescr ~* '(socks|shoes|nike)' Does anybody know > what the expression should be if I want to do 'and' of those key > words instead of 'or' ? Thanks,Sam --------------12F2472176ED16E07558E0C0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit How about  using the  contrib/tsearch  module
that uses gist indexes.

moreover it has  builtin support for word stemming,morphology
and stuff. (to my knowledge)

you would ofcourse require to upgrade to PGSQL7.2
 

excrepts from README.tsearch contrib module.
================
and now you can search all titles with words 'patch' and 'gist':
  select title from titles where titleidx ## 'patch&gist';

Here, ## is a new operation defined for type 'txtidx' which could use index
(if exists) built on titleidx. This operator uses morphology to
expand query, i.e.
  ## 'patches&gist' will find titles with 'patch' and 'gist' also.
If you want to provide query as is, use operator @@ instead:
  select title from titles where titleidx @@ 'patch&gist';
 
 

"Samuel J. Sutjiono" wrote:

This expression matches the word socks or shoes or nike in product categorywhere productdescr ~* '(socks|shoes|nike)' Does anybody know what the expression should be  if I want to do 'and' of those key words instead of 'or' ? Thanks,Sam
--------------12F2472176ED16E07558E0C0--