Group: pgsql.docs


Subject: Normalized Ranking example incorrect in text search
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/14/2007 2:37:22 PM
Simon Riggs <simon@2ndquadrant.com> writes: > http://developer.postgresql.org/pgdocs/postgres/textsearch-controls.html > Ranking Search Results > shows and example which says > "This is the same example using normalized ranking" > 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. > A correct example > would be something like this: > SELECT title, ts_rank_cd(textsearch, query, 8 /*Normalization*/) AS rank Why is that correct (or more correct than other ways)? > - Can we say what the differences are between the two ranking functions? > Why do we have two? We already say that: the _cd function doesn't work without positional info in the input tsvector. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Subject: Normalized Ranking example incorrect in text search
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/14/2007 2:49:26 PM
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 ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly