Re: Regular Expression for 'and' instead of 'or'

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Regular Expression for 'and' instead of 'or'
Date: 2002-02-23 06:25:26
Message-ID: 3C7735D6.7E87781A@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kenneth Gangstoe 2002-02-23 10:35:23 Re: game db
Previous Message Lamar Owen 2002-02-23 05:04:17 Re: Cannot restart the postmaster

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2002-02-23 06:37:28 should I use postgresql arrays...
Previous Message Masaru Sugawara 2002-02-23 06:18:09 Re: Matching columns in rows from two tables