Convert Simple Query into tsvector & tsquery format.
От | Adarsh Sharma |
---|---|
Тема | Convert Simple Query into tsvector & tsquery format. |
Дата | |
Msg-id | 4D830322.6070204@orkash.com обсуждение исходный текст |
Ответы |
Re: Convert Simple Query into tsvector & tsquery format.
|
Список | 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
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 по дате отправления: