X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id BBBB2CC74A for ; Thu, 17 Jul 2003 00:51:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 27699-09 for ; Thu, 17 Jul 2003 00:52:14 +0000 (GMT) Received: from smtpauth2-ext.prodigy.net (smtpauth2-ext.prodigy.net [207.115.63.116]) by svr1.postgresql.org (Postfix) with ESMTP id 75F67CC745 for ; Wed, 16 Jul 2003 21:51:49 -0300 (ADT) Received: from slappy ([66.113.87.163]) (authenticated) by smtpauth2-ext.prodigy.net (8.11.0/8.11.0) with ESMTP id h6H0qGB100682 for ; Wed, 16 Jul 2003 20:52:16 -0400 From: "jtx" To: Subject: relevance Date: Wed, 16 Jul 2003 17:52:17 -0700 Message-ID: <001001c34bfd$acad8d50$c733a8c0@slappy> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/207 X-Sequence-Number: 14321 I'm trying to build a really basic search engine for a site I'm using - say I'm going to simplify this as much as I can. Say I have a table with 2 columns: id, message Person wants to search for the term 'sql'. So, I'd do a simple search like: select id from tablename where message like '%sql%'; If there any way to determine exactly how many times 'sql' is matched in that search in each particular row, and then sort by the most matches, or am I going to have to write a script to do the sorting for me? Thanks!