Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlwnR-0003vR-On for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 15:49:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlwnQ-0002OK-Lc for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 15:49:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlwnQ-0002OD-Fw for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 15:49:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlwnO-0000So-A3 for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 15:49:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05IFneUZ1551297; Thu, 18 Jun 2020 11:49:40 -0400 From: Tom Lane To: chirag.gupta1@globallogic.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16499: Escape Characters in FTS In-reply-to: <16499-261ce565bf7655d7@postgresql.org> References: <16499-261ce565bf7655d7@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 18 Jun 2020 06:31:08 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1551295.1592495380.1@sss.pgh.pa.us> Date: Thu, 18 Jun 2020 11:49:40 -0400 Message-ID: <1551296.1592495380@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > We are using FTS to implement search and there is a scenario where we have a > word say "IVR@#1", when I search for "1" there should not be any result as > per user perspective. > It seems special characters are replaced by spaces/blanks. Is there any way > to include Special characters in search? Kindly let us know through this > channel as earliest possible. You would need to implement your own text search parser that classifies "IVR@#1" as a single token. That's certainly do-able, but it's not exactly trivial. The built-in parser doesn't have any ability to be reconfigured to apply different tokenization rules: it just does what's described at https://www.postgresql.org/docs/current/textsearch-parsers.html On the bright side, it sounds like you might not care too much about URLs or hyphenated words, in which case your custom parser could be far simpler than the built-in one. There is a skeleton parser in our source tree at src/test/modules/test_parser/ that might help you get started. regards, tom lane