Search Postgresql Archives

Convert Simple Query into tsvector & tsquery format.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux