Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V5Jy2-0006ul-QX for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Aug 2013 18:20:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V5Jy2-0008K8-AX for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Aug 2013 18:20:46 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V59Oz-0004A9-Le for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 07:03:53 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V59Ov-00040z-Em for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 07:03:53 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V59Ot-0008Tz-RE for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 07:03:49 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1V59Oo-0007mB-GA for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 07:03:42 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: BUG #8354: stripped positions can generate nonzero rank in ts_rank_cd To: pgsql-bugs@postgresql.org From: alex@hill.net.au Message-Id: Date: Fri, 02 Aug 2013 07:03:42 +0000 X-Pg-Spam-Score: -0.7 (/) 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 The following bug has been logged on the website: Bug reference: 8354 Logged by: Alex Hill Email address: alex@hill.net.au PostgreSQL version: 9.2.4 Operating system: OS X 10.8.4 Mountain Lion Description: Hi all, The docs for ts_rank_cd state: "This function requires positional information in its input. Therefore it will not work on "stripped" tsvector values — it will always return zero." However if a tsvector contains some stripped lexemes and some non-stripped, ts_rank_cd will rank extents including the non-stripped values. For example, this evaluates to zero as expected: SELECT ts_rank_cd(strip(to_tsvector('text search')), plainto_tsquery('text search')) But this doesn't: SELECT ts_rank_cd(to_tsvector('text') || strip(to_tsvector('search')), plainto_tsquery('text search')) I think this is a bug, if not in the code then in the documentation, which isn't clear on what happens when stripped and positioned lexemes are mixed in one tsvector. I would prefer that stripped lexemes were completely ignored by ts_rank_cd: my use case is using this as a fifth pseudo-weight, which matches a @@ query but doesn't add to a ts_rank_cd ranking. What do you think? Cheers, Alex -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs