Re: Normalized Ranking example incorrect in text search

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: Normalized Ranking example incorrect in text search
Date: 2007-11-14 19:49:26
Message-ID: 11985.1195069766@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I wrote:
> Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Decibel! 2007-11-15 17:11:32 Re: Mentioning Slony in docs
Previous Message Tom Lane 2007-11-14 19:37:22 Re: Normalized Ranking example incorrect in text search