Re: [PATCH] Phrase search ported to 9.6 - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: [PATCH] Phrase search ported to 9.6
Date
Msg-id CAPpHfdvb-A_bL5vYv44mE7=z_7vKN-pZqOvc4ybjS=0xpQ0AjA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Phrase search ported to 9.6  (Dmitry Ivanov <d.ivanov@postgrespro.ru>)
List 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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: fd.c: flush data problems on osx
Next
From: Amit Kapila
Date:
Subject: Re: Relation extension scalability