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

From Adarsh Sharma
Subject Convert Simple Query into tsvector & tsquery format.
Date
Msg-id 4D830322.6070204@orkash.com
Whole thread Raw
Responses Re: Convert Simple Query into tsvector & tsquery format.  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
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%');

I need to convert it into other format that use tsvector & tsquery for Full-Text Searching.

I try and convert it like :

SELECT count(*)  from page_content WHERE publishing_date like '%2010%' and
content_language='en' and content is not null and isprocessable = 1 and
to_tsvector('english',content) @@ to_tsquery('english','Mujahid' || ' | '

|| 'jihad' || ' | ' || 'Militant' || ' | ' || 'fedayeen' || ' | ' || 'insurgent' || ' | ' || 'terrORist' || ' | ' || 'cadre'

 || ' | ' || 'civilians' || ' | ' || 'police' || ' | ' || 'cops' || ' | ' || 'crpf' || ' | ' || 'defence' || ' | ' || 'dsf' || ' | ' || 'ssb') ;

But not able to convert and use the condition

AND condition (  AND (content like '%kill%' OR content like '%injure%')  )  also.

Please
help me , how to add this to the query.

Thanks & best Regards,
Adarsh Sharma

pgsql-general by date:

Previous
From: Joe Abbate
Date:
Subject: Re: regclass and search_path
Next
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: triggers and FK cascades