[HACKERS] new function for tsquery creartion
От | Victor Drobny |
---|---|
Тема | [HACKERS] new function for tsquery creartion |
Дата | |
Msg-id | fe931111ff7e9ad79196486ada79e268@postgrespro.ru обсуждение исходный текст |
Ответы |
Re: [HACKERS] new function for tsquery creartion
|
Список | pgsql-hackers |
Dear all, Now Postgres has a few functions to create tsqueries for full text search. The main one is the to_tsquery function that allows to make query with any operation. But to make correct query all of the operators should be specified explicitly. In order to make it easier postgres has functions like plainto_tsquery and phraseto_tsquery which allow to make tsqueries from strings. But they are not flexible enough. Let me introduce new function for full text search query creation(which is called 'queryto_tsquery'). It takes 'google like' query string and translates it to tsquery. The main features are the following: All the text inside double quotes would be treated as a phrase("a b c" -> 'a <-> b <-> c') New operator AROUND(N). It matches if the distance between words(or maybe phrases) is less than or equal to N. Alias for !('-rat' is the same as '!rat') Alias for |('dog OR cat' is the same as 'dog | cat') As a plainto_tsquery and phraseto_tsquery it will fill operators by itself, but already placed operations won't be ignored. It allows to combine two approaches. In the attachment you can find patch with the new features, tests and documentation for it. What do you think about it? Thank you very much for the attention! -- ------ Victor Drobny Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Вложения
В списке pgsql-hackers по дате отправления: