Re: new function for tsquery creartion

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>
Cc: Aleksandr Parfenov <a(dot)parfenov(at)postgrespro(dot)ru>, David Steele <david(at)pgmasters(dot)net>, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: new function for tsquery creartion
Date: 2018-03-26 11:32:05
Message-ID: CAEepm=3dQmh7NCC_ap-L4yMiVRcZuPXtJUv5_mOnYdoqsnUKvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On Mon, Mar 26, 2018 at 9:51 PM, Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru> wrote:
>> Recently I worked with the old version of the patch and found a bug.
>> So, I think it is better to notify you immediately, so you can fix it in
>> rebased/revised version.
>>
>> I noticed, that operator AROUND(N) works only
>> in case of non-negative operands. If any of the operands is negative, it
>> behaves as phrase operator <N>. It is caused by lack of TS_NOT_EXAC
>> flag and AROUND(N) operator check in function TS_phrase_execute in
>> branches for negated operands.
>
> Good to know, thanks! To be honest, I' sure that Theodor is right: it's
> better to implement AROUND(N) operator using <N, M> when it's committed. The
> following version of patch won't support AROUND(N). I have to fix a few more
> questionable things, though.

Hi,

I took a quick look at the language in the last version of the patches.

Patch 01:

+ errmsg("Invalid AROUND(X) operator!")));

s/I/i/;s/!//

+ errmsg("Missing ')' in AROUND(X) operator")));

s/M/m/

Patch 03 (the documentation) needed some proof-reading. I've attached
a new version of that patch with some small suggested improvements.

Questions I had while reading the documentation without looking at the
code: Is there anything to_tsquery() can do that
websearch_to_tsquery() can't? The documentation doesn't mention
parentheses, but I can see that they are in fact supported from the
regression test. Would it be OK to use user-supplied websearch
strings? Ie can it produce a syntax error? Well clearly it can, see
above -- perhaps that should be explicitly documented? Is there any
way to write OR as a term (that's a valuable non-stopword in French)?

It seems like AROUND(x) should be documented also more generally for
tsquery, but I see there is some discussion about how that should
look.

By the way, not this patch's fault, but I noticed that commit
f5f1355dc4d did this:

- (errmsg("query contains only
stopword(s) or doesn't contain lexeme(s), ignored")));
+ (errmsg("text-search query contains
only stop words or doesn't contain lexemes, ignored")));

But the old test still appears in an example in doc/src/sgml/textsearch.sgml.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
docs.patch application/octet-stream 5.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-03-26 11:42:57 Re: [HACKERS] path toward faster partition pruning
Previous Message Chapman Flack 2018-03-26 11:30:10 Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility