Re: Normalized Ranking example incorrect in text search - Mailing list pgsql-docs

From Tom Lane
Subject Re: Normalized Ranking example incorrect in text search
Date
Msg-id 11985.1195069766@sss.pgh.pa.us
Whole thread Raw
In response to Re: Normalized Ranking example incorrect in text search  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-docs
I wrote:
> Simon Riggs <simon@2ndquadrant.com> 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

pgsql-docs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Normalized Ranking example incorrect in text search
Next
From: Decibel!
Date:
Subject: Re: Mentioning Slony in docs