Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4323E2E1C5B for ; Wed, 14 Nov 2007 02:25:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 26304-05 for ; Wed, 14 Nov 2007 02:24:50 -0400 (AST) Received: from outmail129181.authsmtp.co.uk (outmail129181.authsmtp.co.uk [62.13.129.181]) by postgresql.org (Postfix) with ESMTP id C19562E1BA6 for ; Wed, 14 Nov 2007 02:24:57 -0400 (AST) Received: from outmail128184.authsmtp.net (outmail128184.authsmtp.net [62.13.128.184]) by punt3.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id lAE6OkE4001712 for ; Wed, 14 Nov 2007 06:24:46 GMT Received: from [192.168.51.37] ([212.11.57.178]) (authenticated bits=0) by mail.authsmtp.com (8.13.8/8.13.8/Kp) with ESMTP id lAE6Oirr010960 for ; Wed, 14 Nov 2007 06:24:45 GMT Subject: Normalized Ranking example incorrect in text search From: Simon Riggs To: pgsql-docs@postgresql.org Content-Type: text/plain Date: Wed, 14 Nov 2007 06:24:51 +0000 Message-Id: <1195021491.4378.71.camel@ebony.site> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Content-Transfer-Encoding: 7bit X-Server-Quench: 4afbfae0-927a-11dc-b86a-001185d377ca X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MOFUSTAAU PkFRNXJLN0YASktU QCdXRQsWBxNwXXwL NExObwVdZVpOWQ9o VEJNRxxQFQd2AB0f AxkAUx56aAdDZ34+ OTcXWA8CHgZ6dEZ0 RE4aFG4GYylkOTZN BhENdx5dcgQbYx5E PgNiBnsLMHgHZnth T1I/ZG9uNjxJDiNP RwgJLEAfTQ4xFzg/ RhYNVTg/FEgdQyh7 LhotLUQGEU0NekQ0 eUcsSU5QKBIbEAZe d3Ns X-Authentic-SMTP: 61633235383639.squirrel.dmpriest.net.uk:752/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-Status: No virus detected - but ensure you scan with your own anti-virus system! X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/52 X-Sequence-Number: 4585 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, yet without using the normalization parameter. A correct example would be something like this: SELECT title, ts_rank_cd(textsearch, query, 8 /*Normalization*/) AS rank FROM apod, to_tsquery('neutrino|(dark & matter)') query WHERE query @@ textsearch ORDER BY rank DESC LIMIT 10; I can't rerun the query because I don't have the example data set used. Is that available? This section also describes the two ranking functions supplied and suggests you can write your own also. - Can we say what the differences are between the two ranking functions? Why do we have two? - Can we supply or link to an example ranking function to allow people to write their own? -- Simon Riggs 2ndQuadrant http://www.2ndQuadrant.com