Received: from mail.austin.rr.com (sm1.texas.rr.com [24.93.35.54]) by hub.org (8.10.1/8.10.1) with ESMTP id e6ALRFW16846 for ; Mon, 10 Jul 2000 17:27:15 -0400 (EDT) Received: from austin.rr.com ([24.28.74.65]) by mail.austin.rr.com with Microsoft SMTPSVC(5.5.1877.357.35); Mon, 10 Jul 2000 16:28:27 -0500 Message-ID: <396A409C.520CCDA@austin.rr.com> Date: Mon, 10 Jul 2000 16:31:08 -0500 From: Ed Loehr X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.12-20smp i686) X-Accept-Language: en MIME-Version: 1.0 To: tim@lincolnshirenow.com CC: pgsql-sql@postgresql.org Subject: Re: Re: Matching and Scoring with multiple fields References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/110 Tim Johnson wrote: > > I have a table like this: > > a,b,c,d,e,f,g,h > --------------- > 2,5,3,4,4,5,2,2 > 1,1,1,1,1,1,1,1 > > a to h are of type int. > > I want to take input values which relate to this table say: > how do you feel about a: > how do you feel about b: > how do you feel about c: > ... > > and the answers will be 1 to 5. > > Now I want to take those answers for my incoming a to h and scan down the > table pulling out the closest matches from best to worst. I wonder if you don't really just want to find the vector(s) closest in N-space to the input vector. You might dig up an old 3-variable calculus book, find the formula, and write a PL/pgSQL function to compute the distance between two N-dimensional vectors... Regards, Ed Loehr