Re: Text search lexer's handling of hyphens and negatives

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: Text search lexer's handling of hyphens and negatives
Дата
Msg-id abf85423-ce4b-45ec-97a4-2789a400ed55@manitou-mail.org
обсуждение исходный текст
Ответ на Text search lexer's handling of hyphens and negatives  (raylu <lurayl@gmail.com>)
Список pgsql-general
    raylu wrote:

> to_tsvector('simple', 'UVW-789-XYZ') is
> 'uvw':1 '-789':2 'xyz':3
> because -789 is a negative integer. If we turn the query '789-XYZ'
> into the tsquery as before, we get to_tsquery('simple', '789 <-> xyz')
> which doesn't match it.
>
> Are we missing something here? Is there either a way to
> 1. generate tsvectors without this special (negative) integer behavior or

As an ad-hoc solution, you could add a dictionary that turns a negative
integer into its positive counterpart. There's a dictionary in contrib that
can be used as a starting point:
https://www.postgresql.org/docs/current/dict-int.html

It's a matter of ~10 lines of C code to add an "abs" parameter to
that dictionary that would, when true, produce "789" as a lexem
when fed "-789" as input.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



В списке pgsql-general по дате отправления:

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: Is there any configuration in postgresql.conf or any otherconfiguration of postgres which will make this possible to listen onparticular interface
Следующее
От: Thomas Kellerer
Дата:
Сообщение: A little confusion about JSON Path