Re: [PATCH] Phrase search ported to 9.6

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>
Cc: Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Phrase search ported to 9.6
Date: 2016-03-21 12:01:56
Message-ID: CAPpHfdvb-A_bL5vYv44mE7=z_7vKN-pZqOvc4ybjS=0xpQ0AjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

I see that patch changes existing regression tests in tsearch2.out.

*** a/contrib/tsearch2/expected/tsearch2.out
--- b/contrib/tsearch2/expected/tsearch2.out
*************** SELECT '(!1|2)&3'::tsquery;
*** 278,292 ****
(1 row)

SELECT '1|(2|(4|(5|6)))'::tsquery;
! tsquery
! -----------------------------------------
! '1' | ( '2' | ( '4' | ( '5' | '6' ) ) )
(1 row)

SELECT '1|2|4|5|6'::tsquery;
! tsquery
! -----------------------------------------
! ( ( ( '1' | '2' ) | '4' ) | '5' ) | '6'
(1 row)

SELECT '1&(2&(4&(5&6)))'::tsquery;
--- 278,292 ----
(1 row)

SELECT '1|(2|(4|(5|6)))'::tsquery;
! tsquery
! -----------------------------
! '1' | '2' | '4' | '5' | '6'
(1 row)

SELECT '1|2|4|5|6'::tsquery;
! tsquery
! -----------------------------
! '1' | '2' | '4' | '5' | '6'
(1 row)

This change looks like improvement, without braces tsquery readability is
much better.

*************** select rewrite('moscow & hotel', 'select
*** 461,469 ****
(1 row)

select rewrite('bar & new & qq & foo & york', 'select keyword, sample
from test_tsquery'::text );
! rewrite
!
-------------------------------------------------------------------------------------
! 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | ( 'big' & 'appl' | 'new' &
'york' ) )
(1 row)

select rewrite( ARRAY['moscow', keyword, sample] ) from test_tsquery;
--- 461,469 ----
(1 row)

select rewrite('bar & new & qq & foo & york', 'select keyword, sample
from test_tsquery'::text );
! rewrite
!
---------------------------------------------------------------------------------
! ( 'nyc' | 'big' & 'appl' | 'new' & 'york' ) & 'citi' & 'foo' & ( 'bar' |
'qq' )
(1 row)

select rewrite( ARRAY['moscow', keyword, sample] ) from test_tsquery;

However, such reorderings look unclear and need motivation.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stas Kelvich 2016-03-21 12:09:56 Re: fd.c: flush data problems on osx
Previous Message Andres Freund 2016-03-21 11:53:32 Re: fd.c: flush data problems on osx