Re: Convert Simple Query into tsvector & tsquery format.

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Convert Simple Query into tsvector & tsquery format.
Date: 2011-03-18 10:21:11
Message-ID: 20110318112111.1f3c9e0f@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 18 Mar 2011 12:30:50 +0530
Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com> wrote:

> Dear all,
>
> I have a simple query mentioned below :
>
> select count(*) from page_content where (content like
> '%Militant%' OR content like '%jihad%' OR content like
> '%Mujahid%' OR content like '%fedayeen%' OR content like
> '%insurgent%' OR content like '%terrORist%' OR
> content like '%cadre%' OR content like '%civilians%' OR content
> like '%police%' OR content like '%defence%' OR content like
> '%cops%' OR content like '%crpf%' OR content like '%dsf%' OR
> content like '%ssb%') AND (content like '%kill%' OR content like
> '%injure%');

It's not clear where the problem is.

select to_tsquery('english', '(yellow | blue) & (red | black)');
to_tsquery
---------------------------------------------
( 'yellow' | 'blue' ) & ( 'red' | 'black' )

select to_tsvector('english', 'yellow red') @@ to_tsquery('english',
'(yellow | blue) & (red | black)');

The only thing I can see that could cause problems is you may have
previously "mangled" words in the ilike query while you'd leave that
task to ts engine that will find a proper lexeme.

Could you be more specific about the problem you're encountering.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Voils, Steven M 2011-03-18 12:21:26 Re: Primary key vs unique index
Previous Message tamanna madaan 2011-03-18 09:31:19 SOCK_wait_for_ready function call caused a query to get stuck