adding a custom tsearch parser

View: New views
2 Messages — Rating Filter:   Alert me  

adding a custom tsearch parser

by ara.t.howard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...' 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

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

Re: adding a custom tsearch parser

by Daniel Verite :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        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

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