full text search and ILIKE type clauses.

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: full text search and ILIKE type clauses.
Date: 2012-03-12 01:37:42
Message-ID: CAGuHJrMpnoX-b5o3ftDZOVZjCJujc+0fGAemLXSSwOLi-q=ifg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I want to be able to search a lot of fields using queries that use
ILIKE and unfortunately many of the queries will be using the
'%SOMETHING%' or '%SOMETHING' type clauses. Since indexes are useless
on those I was thinking I could use tsvectors but I can't figure out
how to accomplish this.

One option I have seen reccomended is to create a tsvector field and
concat the various fields into that field as a tsvector. That would
work for general text search but I am not sure how I could query
FIELD1 ILIKE '%SOMETHING%' vs FIELD2 ILIKE '%SOMETHING%' . Would
using hstore help in this case?

I should point out that some of the fields are numbers. I am willing
to deal with those separately by building other indexes for them but
of course a unified approach would be preferable.

Any help would be much appreciated. Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-03-12 02:56:45 Re: full text search and ILIKE type clauses.
Previous Message Adrian Klaver 2012-03-11 20:51:37 Re: Error installing postgresq91-python package