Re: [GENERAL] How to perform full text search

2012-03-18 Thread John R Pierce
On 03/18/12 11:45 AM, Andrus wrote: select +case when productname ilike '%red%' then 2 else 0 end +case when productdescription ilike '%red%' then 1 else 0 end +case when productname ilike '%cat%' then 1.7 else 0 end +case when productdescription ilike '%cat%' then 0.7 else 0 end from product

Re: [GENERAL] How to perform full text search

2012-03-18 Thread Andrus
Parse the entry string into words (aka tokens) and assemble with the and operator. E.g. 'red cat' becomes 'red & cat'. >Then add vector; more info in articles I provide links to later in this note. WHERE to_tsvector ( productname || ' ' || productdescription ) @@ to_tsquery ( 'red & cat' ) Sin