Re: tsearch Parser Hacking

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch Parser Hacking
Date: 2011-02-15 07:37:53
Message-ID: Pine.LNX.4.64.1102151034050.278@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David,

it's not easy to hack tsearch parser, sorry. You can preparse your input
before to_tsquery,to_tsvector.

Oleg
On Mon, 14 Feb 2011, David E. Wheeler wrote:

> Hackers,
>
> Is it possible to modify the default tsearch parser so that / doesn't get lexed as a "file" token? That is, instead of this:
>
> try=# select * from ts_debug('simple'::regconfig, 'w/d');
> alias │ description │ token │ dictionaries │ dictionary │ lexemes
> ───────┼───────────────────┼───────┼──────────────┼────────────┼─────────
> file │ File or path name │ w/d │ {simple} │ simple │ {w/d}
>
> Ideally it'd think that / was the same as -:
>
> try=# select * from ts_debug('simple'::regconfig, 'w-d');
> alias │ description │ token │ dictionaries │ dictionary │ lexemes
> ─────────────────┼─────────────────────────────────┼───────┼──────────────┼────────────┼─────────
> asciihword │ Hyphenated word, all ASCII │ w-d │ {simple} │ simple │ {w-d}
> hword_asciipart │ Hyphenated word part, all ASCII │ w │ {simple} │ simple │ {w}
> blank │ Space symbols │ - │ {} │ [null] │ [null]
> hword_asciipart │ Hyphenated word part, all ASCII │ d │ {simple} │ simple │ {d}
> (4 rows)
>
> Possible? Or would I have to write a completely new parser just to change this bit?
>
> Thanks,
>
> David
>
>
>

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2011-02-15 07:42:20 Re: tsearch Parser Hacking
Previous Message Jaime Casanova 2011-02-15 06:45:54 Re: Sync Rep for 2011CF1