|From:||Victor Drobny <v(dot)drobny(at)postgrespro(dot)ru>|
|Subject:||new function for tsquery creartion|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
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!
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
|Next Message||Robert Haas||2017-07-19 16:53:34||Re: Something for the TODO list: deprecating abstime and friends|
|Previous Message||Tom Lane||2017-07-19 16:39:07||Re: tupconvert.c API change in v10 release notes|