full text index / search

Started by Philipp Krausalmost 14 years ago4 messagesgeneral
Jump to latest
#1Philipp Kraus
philipp.kraus@flashpixx.de

Hello,

I have created a table with a text field under PG 9.1, that should store source codes. I would like to search in this text field with regular expressions. I think I need a full-text-index, do I?
How can I create this index, do I need some additional extensions? The PG server runs under OSX (installed on the DMG package).

Thanks

Phil

#2Mark Phillips
mark.phillips@mophilly.com
In reply to: Philipp Kraus (#1)
Re: full text index / search

I am not an expert on FTS, but I have been reading and experimenting. Further, I don't know what you are really attempting. With those warnings behind us, I think a GIN or GiST index are helpful in full text searches.

You may find this useful:
Understanding Full Text Search
http://linuxgazette.net/164/sephton.html

I suggest that you review the Postgres Documentation for FTS:
http://www.postgresql.org/docs/9.1/interactive/textsearch.html

One option you may find interesting is the pg_trgm module:
http://www.postgresql.org/docs/9.1/static/pgtrgm.html

hth,

- Mark Phillips

On Jun 15, 2012, at 8:18 AM, Philipp Kraus wrote:

Show quoted text

Hello,

I have created a table with a text field under PG 9.1, that should store source codes. I would like to search in this text field with regular expressions. I think I need a full-text-index, do I?
How can I create this index, do I need some additional extensions? The PG server runs under OSX (installed on the DMG package).

Thanks

Phil
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Philipp Kraus (#1)
Re: full text index / search

Philipp Kraus wrote:

I have created a table with a text field under PG 9.1, that should

store source codes. I would like to

search in this text field with regular expressions. I think I need a

full-text-index, do I?

How can I create this index, do I need some additional extensions? The

PG server runs under OSX

(installed on the DMG package).

A full text index won't help you with regular expressions.
It will only help with full text search using the match operator @@.

Yours,
Laurenz Albe

#4Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Laurenz Albe (#3)
Re: full text index / search

On 18 Červen 2012, 11:04, Albe Laurenz wrote:

Philipp Kraus wrote:

I have created a table with a text field under PG 9.1, that should

store source codes. I would like to

search in this text field with regular expressions. I think I need a

full-text-index, do I?

How can I create this index, do I need some additional extensions? The

PG server runs under OSX

(installed on the DMG package).

A full text index won't help you with regular expressions.
It will only help with full text search using the match operator @@.

Also, it's possible to create regular index with custom operator class for
pattern matching queries. See this

http://www.postgresql.org/docs/9.1/interactive/indexes-opclass.html

Not a full-text index, though ...

T.