Re: new function for tsquery creartion - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: new function for tsquery creartion
Date
Msg-id CAEepm=3dQmh7NCC_ap-L4yMiVRcZuPXtJUv5_mOnYdoqsnUKvg@mail.gmail.com
Whole thread Raw
In response to Re: new function for tsquery creartion  (Dmitry Ivanov <d.ivanov@postgrespro.ru>)
Responses Re: new function for tsquery creartion  (Dmitry Ivanov <d.ivanov@postgrespro.ru>)
List pgsql-hackers
On Mon, Mar 26, 2018 at 9:51 PM, Dmitry Ivanov <d.ivanov@postgrespro.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

pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] path toward faster partition pruning