custom tsearch2 parsers

Started by Kevin Grittneralmost 17 years ago2 messages
#1Kevin Grittner
Kevin.Grittner@wicourts.gov

It appears that I need to put together a custom parser for tsearch2.
The description here:

http://www.postgresql.org/docs/8.3/interactive/textsearch-parsers.html

makes it sound as though the default can be replaced, but I haven't
found any documentation of the API. Tom's post here:

http://archives.postgresql.org/pgsql-general/2009-03/msg00387.php

makes it sound, er..., non-trivial.

Is there any intended direction for this? I suspect that most people
with a need to parse the word boundaries differently would like to
effectively "subclass" the current parser, overriding its behavior for
specific things. Would it be feasible to allow multiple parsers to
handle what they know and pass the rest through, similar to the
dictionaries? I would love to have a parser at the front where I
could give it a regular expression which would match any statute
cites, and let the default parser do the rest.

Is anyone else interested in something like this?

-Kevin

#2Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Kevin Grittner (#1)
Re: custom tsearch2 parsers

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> wrote:

It appears that I need to put together a custom parser for
tsearch2.

Reality check: I need to find start and end locations for all matches
of a regular expression in a text object, very similar to what is done
by setup_regexp_matches in regexp.c for the regexp_split_* functions.
I'm assuming this is copy/paste for 8.4 and prior? (It would be nice
to have a function in regexp.c to return the information using the
existing code, but that's too late for 8.4 and not a candidate for
back patching?)

Just thought I'd confirm before duplicating that much code.

-Kevin