Thread: adding a custom tsearch parser

adding a custom tsearch parser

From
"ara.t.howard"
Date:
i've been playing with the new built-in tsearch functionality and it's
really, really cool.

however, the default parser seems a overly complicated and
non-principle-of-least-surprise - at least to me.

for instance

filename.jpg

will not be found by a search for 'filename', since the default parser
considers 'filename.jpg' not only as one token, but as a hostname.

imho, the best default lexizer would simply scan for patterns of
alph-numerics.  in ruby

  tokens = content.scan( /\w+/ )

this makes for a very non surprising indexer since a search for 'ara'
after indexing 'ara.t.howard@gmail.com' would pull up that record.
currently it does not, since the entire token is consumed as an
'email' token.

my questions are

1) can the current parser be configured in any way?

2) if not, can someone provide and direction towards writing my own
and configuring pg to use it?

3) has any thought been given towards a more general purpose default
parser shipping with pg?  (few sites would consider 'versions' as
tokens except those run for us geeks)

kind regards.

--
-a
--
be kind whenever possible... it is always possible - h.h. the 14th dalai lama

Re: adding a custom tsearch parser

From
"Daniel Verite"
Date:
    ara.t.howard wrote:

> my questions are
>
> 1) can the current parser be configured in any way?
>
> 2) if not, can someone provide and direction towards writing my own
> and configuring pg to use it?

http://www.postgresql.org/docs/current/static/test-parser.html

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org