Add Space symbols for TSvector

Started by Henk van Lingenalmost 17 years ago5 messagesgeneral
Jump to latest
#1Henk van Lingen
H.G.K.vanLingen@uu.nl

Hi,

How can I add a character as space symbol for the full text search indexes?

I'm adding firewall syslog lines in a database (8.3.7), and have a GIN
index on the message field. I'd like the slash considered a space symbol,
so i can search for IPnumbers in test like

world/123.456.192.46(0) -> some-fwsm/123.456.221.121(0)

Regards,
--
Henk van Lingen, (o- -+
Netwerk & Telefonie, ICT Service Center /\ |
Universiteit Utrecht, Jenalaan 18a, kamer 1.40 v_/_
http://henk.vanlingen.net/ http://www.tuxtown.net/netiquette/

#2Oleg Bartunov
oleg@sai.msu.su
In reply to: Henk van Lingen (#1)
Re: Add Space symbols for TSvector

On Thu, 25 Jun 2009, Henk van Lingen wrote:

Hi,

How can I add a character as space symbol for the full text search indexes?

I'm adding firewall syslog lines in a database (8.3.7), and have a GIN
index on the message field. I'd like the slash considered a space symbol,
so i can search for IPnumbers in test like

world/123.456.192.46(0) -> some-fwsm/123.456.221.121(0)

preprocess text, for example, using replace(), regexp_replace() functions

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

#3Henk van Lingen
H.G.K.vanLingen@uu.nl
In reply to: Oleg Bartunov (#2)
Re: Add Space symbols for TSvector

On Thu, Jun 25, 2009 at 01:05:41PM +0400, Oleg Bartunov wrote:

How can I add a character as space symbol for the full text search indexes?

I'm adding firewall syslog lines in a database (8.3.7), and have a GIN
index on the message field. I'd like the slash considered a space symbol,
so i can search for IPnumbers in test like

world/123.456.192.46(0) -> some-fwsm/123.456.221.121(0)

preprocess text, for example, using replace(), regexp_replace() functions

Oke, you mean at the time the insert in de db is done, i suppose.
However, I'm using the new syslog-ng 3 feature which does the
insert directly. So I have to change the syslogd for that.

I understand the ts_search parser is not configurable?

Thanks,
--
Henk van Lingen, (o- -+
Netwerk & Telefonie, ICT Service Center /\ |
Universiteit Utrecht, Jenalaan 18a, kamer 1.40 v_/_
http://henk.vanlingen.net/ http://www.tuxtown.net/netiquette/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Henk van Lingen (#3)
Re: Add Space symbols for TSvector

Henk van Lingen <H.G.K.vanLingen@uu.nl> writes:

I understand the ts_search parser is not configurable?

You can substitute your own parser, but the built-in one doesn't have
any provisions for fine-grained configuration.

regards, tom lane

#5Arjen Nienhuis
a.g.nienhuis@gmail.com
In reply to: Henk van Lingen (#3)
Re: Add Space symbols for TSvector

preprocess text, for example, using replace(), regexp_replace() functions

Oke, you mean at the time the insert in de db is done, i suppose.
However, I'm using the new syslog-ng 3 feature which does the
insert directly. So I have to change the syslogd for that.

I understand the ts_search parser is not configurable?

you can make function f(s) -> replace(replace(s, foo, bar), baz, bar)

and then search and index on f(s)

CREATE INDEX ... ON table ((f(s)));
SELECT s FROM table WHERE f(s) "matches?" '127.0.0.1';