From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: Samuel J. Sutjiono <ssutjiono@wc-group.com>
To: pgsql-sql@postgresql.org
Subject: Re: Regular Expression for 'and' instead of 'or'
Date: Sat, 23 Feb 2002 11:55:26 +0530
Message-ID: <3C7735D6.7E87781A@trade-india.com> (raw)
References: <023101c1bbc3$03a33910$110a010a@headquarters.wcgroup.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mallah@trade-india.com, ssutjiono@wc-group.com
Subject: Re: Regular Expression for 'and' instead of 'or'
In-Reply-To: <3C7735D6.7E87781A@trade-india.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox