Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8CB4A2E017A for ; Fri, 7 Mar 2008 00:31:52 -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 09560-04 for ; Fri, 7 Mar 2008 00:31:49 -0400 (AST) X-Greylist: delayed 00:34:06.220769 by SQLgrey-1.7.5 Received: from hosted03.westnet.com.au (hosted03.westnet.com.au [203.10.1.215]) by postgresql.org (Postfix) with ESMTP id 0A5A52E0163 for ; Fri, 7 Mar 2008 00:31:48 -0400 (AST) Received: from hosted03.westnet.com.au (hosted03.westnet.com.au [127.0.0.1]) by hosted03.westnet.com.au (Postfix) with SMTP id 6399C308D2C for ; Fri, 7 Mar 2008 12:57:31 +0900 (WST) Received: from windoze (dsl-124-150-102-128.vic.westnet.com.au [124.150.102.128]) by hosted03.westnet.com.au (Postfix) with ESMTP id F2300309E98 for ; Fri, 7 Mar 2008 12:57:25 +0900 (WST) From: "b wragg" To: Subject: Improve Full text rank in a query Date: Fri, 7 Mar 2008 14:58:47 +1100 Message-ID: <000b01c88007$8c07b1a0$0502a8c0@windoze> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 thread-index: AciAB4t73pWH/affQ8CgzRSLn2/wUw== X-PMX-Branch: TNG-Outgoing X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200803/143 X-Sequence-Number: 29097 Hi all, I'm running the following query to match a supplied text string to an actual place name which is recorded in a table with extra info like coordinates, etc. SELECT ts_rank_cd(textsearchable_index_col , query, 32 /* rank/(rank+1) */) AS rank,* FROM gazetteer, to_tsquery('Gunbower|Island|Vic') query WHERE query @@ textsearchable_index_col order by rank desc, concise_ga desc, auda_alloc desc LIMIT 10 When I run this I get the following top two results: Pos Rank Name State 1 0.23769 Gunbower Island Primary School Vic 2 0.23769 Gunbower Island Vic The textsearchable_index_col for each of these looks like this: 'vic':6 '9999':5 'gunbow':1 'island':2 'school':4 'primari':3 'victoria':7 'vic':4 '9999':3 'gunbow':1 'island':2 'victoria':5 I'm new to this, but I can't figure out why the "Gunbower Island Primary School" is getting top place. How do I get the query to improve the ranking so that an exact match (like "Gunbower|Island|Vic") gets a higher position? Thanks, bw No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.4/1309 - Release Date: 3/03/2008 6:50 PM