Text Searching? - Mailing list pgsql-novice

From Announce
Subject Text Searching?
Date
Msg-id KBEKKNMFLELKGIADDEPEMEEPCBAA.truthhurts@insightbb.com
Whole thread Raw
Responses Re: Text Searching?  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
I have a couple of best practice questions for doing web searches on
Postgres tables.  Let's say I have a table of employees with A LOT of rows
that I would like to regularly do searches on (from a PHP web page, etc):


EMPLOYEES (table)
--------------------------------
empl_id        pri key
firstname        text or varchar
middlename        text or varchar
lastname        text or varchar
fullname        text or varchar  (firstname+middle+lastname)

Contrived, I know. ANYWAY...

A. Any suggestions for doing full-text searches in Postgres? I have some
primitive ideas of how to do this, but from what I can see, using LIKE
together with an expression that starts with "%" does not make use of the
indexes I have created. How can I set myself up to perform the fastest
possible search?

B. How should the fields be defined? Should they be VARCHAR with a character
limit or just TEXT,etc?

Thanks,

Aaron


pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: stupid SQL question, how reach different rows of two almost same tables
Next
From: Michael Fuhr
Date:
Subject: Re: Text Searching?