How to perform full text search

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to perform full text search
Date: 2012-03-15 19:33:00
Message-ID: 7F1C5A8700D54CEEB1FEAEB4594D14DF@dell2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

User can enter any number of words as search string.
In shopping cart the following query is used to find products,
eq. if "red cat" is entered:

select * from products
where productname ilike '%'||'red cat'||'%'
or productdescription ilike '%'||'red cat'||'%'
limit 100

This does not find products like "red or black cat".
How to change this query so that it returns 100 best matches for for given search string?
I read documentaton about full text search but havent found step by step solution for this.

Using PostgreSQL 8.2.7 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Should I install some contribs to 8.2 or is it better to upgrade server ?

Where to find step by step instructions making this work ?

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2012-03-15 19:34:43 Re: psql latex and newlines
Previous Message Adrian Klaver 2012-03-15 19:30:13 Re: Using copy with a file containing blank rows