Re: Convert Simple Query into tsvector & tsquery format. - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: Convert Simple Query into tsvector & tsquery format.
Date
Msg-id 20110318112111.1f3c9e0f@dawn.webthatworks.it
Whole thread Raw
In response to Convert Simple Query into tsvector & tsquery format.  (Adarsh Sharma <adarsh.sharma@orkash.com>)
List pgsql-general
On Fri, 18 Mar 2011 12:30:50 +0530
Adarsh Sharma <adarsh.sharma@orkash.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


pgsql-general by date:

Previous
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: triggers and FK cascades
Next
From: Scott Marlowe
Date:
Subject: Re: Primary key vs unique index