Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9BAA32E28AD for ; Wed, 14 Nov 2007 15:49:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27026-05 for ; Wed, 14 Nov 2007 15:49:28 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D64D32E2762 for ; Wed, 14 Nov 2007 15:49:27 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lAEJnQww011986; Wed, 14 Nov 2007 14:49:26 -0500 (EST) To: Simon Riggs cc: pgsql-docs@postgresql.org, Oleg Bartunov , Teodor Sigaev Subject: Re: Normalized Ranking example incorrect in text search In-reply-to: <11802.1195069042@sss.pgh.pa.us> References: <1195021491.4378.71.camel@ebony.site> <11802.1195069042@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 14 Nov 2007 14:37:22 -0500" Date: Wed, 14 Nov 2007 14:49:26 -0500 Message-ID: <11985.1195069766@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/55 X-Sequence-Number: 4588 I wrote: > Simon Riggs writes: >> and then gives a query which calculates normalization in an incorrect >> manner, > On what basis do you claim that's an incorrect manner? It's exactly > what is described in the paragraph just before the examples. ... although on reflection, it seems pretty stupid to be recommending a method that requires two evaluations at each row of an admittedly expensive function. Seems like we should add one more normalization flag bit: 32 --- replace computed rank by rank / (rank + 1) and then the second example would be SELECT title, ts_rank_cd(textsearch, query, 32 /* rank/(rank+1) */) AS rank FROM apod, to_tsquery('neutrino|(dark & matter)') query WHERE query @@ textsearch ORDER BY rank DESC LIMIT 10; with no change in the example output. regards, tom lane