Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJg7j-0007qH-Qx for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2016 12:36:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cJg7i-0003bF-PG for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2016 12:35:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cJg6J-0001xI-0S for pgsql-hackers@postgreSQL.org; Wed, 21 Dec 2016 12:34:31 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJg6E-0006VG-Hp for pgsql-hackers@postgreSQL.org; Wed, 21 Dec 2016 12:34:29 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id DCE0221C2285; Wed, 21 Dec 2016 15:34:23 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Subject: Re: Rethinking our fulltext phrase-search implementation DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1482323663; bh=rdHEnB4imgi8qbg/+MMe2+KKinhB/U6Fb3UEC5d/e6w=; h=To:References:From:Date:In-Reply-To; b=cXW9lYJCAd9yif3MRtmnE4TwwtM62grsWs75h2fE9Zsjz7+OtE/6s7wyKiaFbO/w4 vPRvOCjg2kx90xiDIZW/X678kBjS1Qo3USjFiR/ZRUR+qk4+txTXHSmljwqFyvEQNm YZc6ZXKP5o/hGHlFgDcmk80WjRdC82mfQvnfrmPw= To: Tom Lane , pgsql-hackers@postgreSQL.org References: <28215.1481999808@sss.pgh.pa.us> From: Artur Zakirov Message-ID: <773bb687-1388-6c78-af23-5635a41a243d@postgrespro.ru> Date: Wed, 21 Dec 2016 15:34:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <28215.1481999808@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hello Tom, On 17.12.2016 21:36, Tom Lane wrote: > > 4. The transformations are wrong anyway. The OR case I showed above is > all right, but as I argued in <24331.1480199636@sss.pgh.pa.us>, the AND > case is not: > > regression=# select 'a <-> (b & c)'::tsquery; > tsquery > --------------------------- > 'a' <-> 'b' & 'a' <-> 'c' > (1 row) > > This matches 'a b a c', because 'a <-> b' and 'a <-> c' can each be > matched at different places in that text; but it seems highly unlikely to > me that that's what the writer of such a query wanted. (If she did want > that, she would write it that way to start with.) NOT is not very nice > either: If I'm not mistaken PostgreSQL 9.6 and master with patch "fix-phrase-search.patch" return false for the query: select 'a b a c' @@ 'a <-> (b & c)'::tsquery; ?column? ---------- f (1 row) I agree that such query is confusing. Maybe it is better to return true for such queries? Otherwise it seems that queries like 'a <-> (b & c)' will always return false. Then we need maybe some warning message. -- Artur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers