Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 385CD19CDE12 for ; Mon, 5 Dec 2011 11:38:20 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RXacU-0008J8-3j for pgsql-bugs@postgresql.org; Mon, 05 Dec 2011 15:38:19 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pB5Fc4Ec027804; Mon, 5 Dec 2011 10:38:04 -0500 (EST) To: Marcin.Kasperski@mekk.waw.pl cc: pgsql-bugs@postgresql.org, Oleg Bartunov , Teodor Sigaev Subject: Re: BUG #6327: Prefix full-text-search fails for hosts with complicated names In-reply-to: References: Comments: In-reply-to Marcin.Kasperski@mekk.waw.pl message dated "Mon, 05 Dec 2011 12:40:10 +0000" Date: Mon, 05 Dec 2011 10:38:04 -0500 Message-ID: <27803.1323099484@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201112/43 X-Sequence-Number: 31854 Marcin.Kasperski@mekk.waw.pl writes: > Synopsis > ========= > 'goog:*' matches google.com > but > 'e-goog:*' does not match e-google.com The reason for this seems to be that the pattern is treated as a hyphenated word: regression=# select TO_TSQUERY('english', 'e-goog:*'); to_tsquery ------------------------------- 'e-goog':* & 'e':* & 'goog':* (1 row) but the hostname isn't: regression=# select TO_TSVECTOR('english', 'See e-google.com'); to_tsvector -------------------------- 'e-google.com':2 'see':1 (1 row) If you change the text so it's not recognized as a hostname, you get lexemes that would match the query: regression=# select TO_TSVECTOR('english', 'See e-google com'); to_tsvector --------------------------------------------- 'com':5 'e':3 'e-googl':2 'googl':4 'see':1 (1 row) Possibly we could fix this by hacking the ts parser so that it would also apply the hyphenated-word rules to a hostname containing a dash. In general though, there are always going to be cases where prefix match doesn't work because of dictionary transformations ... regards, tom lane