Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aWMEJ-0003sT-3A for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Feb 2016 10:54:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aWMEI-0005r8-M2 for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Feb 2016 10:54:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aWMDf-00059N-Nt for pgsql-bugs@postgresql.org; Thu, 18 Feb 2016 10:53:59 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aWMDX-0003Wc-5w for pgsql-bugs@postgresql.org; Thu, 18 Feb 2016 10:53:59 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id CD5E121C0640; Thu, 18 Feb 2016 13:53:49 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cplv0BzT4G7I; Thu, 18 Feb 2016 13:53:43 +0300 (MSK) Received: from [192.168.27.188] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2EEDC21C0635; Thu, 18 Feb 2016 13:53:42 +0300 (MSK) Subject: Re: BUG #13964: unexpected result from to_tsvector To: ruxandra.durus@vauban.ro, pgsql-bugs@postgresql.org References: <20160217080048.26357.49416@wrigleys.postgresql.org> From: Artur Zakirov Message-ID: <56C5A2B7.60006@postgrespro.ru> Date: Thu, 18 Feb 2016 13:53:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160217080048.26357.49416@wrigleys.postgresql.org> Content-Type: multipart/mixed; boundary="------------040802050603070007050805" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------040802050603070007050805 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 17.02.2016 11:00, ruxandra.durus@vauban.ro wrote: > > My version of PostgreSQL is: > "PostgreSQL 9.5beta1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 > 20120313 (Red Hat 4.4.7-16), 64-bit" > > More details about the operating system: > Linux javatesting 2.6.32-573.7.1.el6.x86_64 #1 SMP Tue Sep 22 22:00:00 UTC > 2015 x86_64 x86_64 x86_64 GNU/Linux > > I am using pgAdmin version 1.20.0 to query the database. > > I am using your full text search (which works great), but i have a small > problem: > SELECT to_tsvector('simple', 'test@vauban-reg.ro'); > > returns "'test@vauban-reg.ro':1" > > which is exactly what I need. > > > But when I run : > > SELECT to_tsvector('simple', 'test@123-reg.ro'); > > I get: > "'123':2 'reg.ro':3 'test':1" > > instead of "'test@123-reg.ro':1" > >>From the documentation here > http://www.postgresql.org/docs/current/static/pgtrgm.html , point F.30.4. I > understood that with "simple" option only space is a separator for the > stems. Is it a bug or am I doing something wrong? > > Thank you for your time, > Ruxandra Durus > Hi, It seems that this is a text search parser issue. More informative queries: => SELECT * FROM ts_debug('simple', 'test@vauban-reg.ro'); alias | description | token | dictionaries | dictionary | lexemes -------+---------------+--------------------+--------------+------------+---------------------- email | Email address | test@vauban-reg.ro | {simple} | simple | {test@vauban-reg.ro} (1 row) => SELECT * FROM ts_debug('simple', 'test@123-reg.ro'); alias | description | token | dictionaries | dictionary | lexemes -----------+------------------+--------+--------------+------------+---------- asciiword | Word, all ASCII | test | {simple} | simple | {test} blank | Space symbols | @ | {} | | uint | Unsigned integer | 123 | {simple} | simple | {123} blank | Space symbols | - | {} | | host | Host | reg.ro | {simple} | simple | {reg.ro} (5 rows) Attached patch can fix it. Is this a bug? Should I create a record in the commitfest? This patch also allows to parser work with emails '123@123-reg.ro' and 'test@123_reg.ro' correctly. -- Artur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company --------------040802050603070007050805 Content-Type: text/x-patch; name="number_in_email.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="number_in_email.patch" *** a/src/backend/tsearch/wparser_def.c --- b/src/backend/tsearch/wparser_def.c *************** *** 1121,1126 **** static const TParserStateActionItem actionTPS_InUnsignedInt[] = { --- 1121,1129 ---- {p_iseqC, '.', A_PUSH, TPS_InUDecimalFirst, 0, NULL}, {p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL}, {p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL}, + {p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL}, + {p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL}, + {p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL}, {p_isasclet, 0, A_PUSH, TPS_InHost, 0, NULL}, {p_isalpha, 0, A_NEXT, TPS_InNumWord, 0, NULL}, {p_isspecial, 0, A_NEXT, TPS_InNumWord, 0, NULL}, --------------040802050603070007050805 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------040802050603070007050805--