Re: Ranking search results using multiple fields in PostgreSQL fulltext search

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Gaini Rajeshwar <raja(dot)rajeshwar2006(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Ranking search results using multiple fields in PostgreSQL fulltext search
Date: 2009-10-12 13:23:56
Message-ID: 4AD32DEC.1030604@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/10/2009 14:16, Gaini Rajeshwar wrote:
> Hi,
> is there a way to rank the search results based on multiple fields in
> postgreSQL?
> For example,
> i have *title*, *abstract*, *summary*, *body* as fields/columns in my
> database. When user searches on *title*, i want to rank the results based on
> *title* field as well as *summary* field, where importance(summary) >
> importance(title). But the results should be exactly matching the terms in
> "title" rather than "title" OR "summary"
>

Hoe do you define "importance"?

You can order the results alphabetically/numerically on as many columns
as you like - for example,

select ....
where title = ....
order by title, summary

will order the results on title first, then summary... though you
probably know this and I'm misunderstanding what you need.

A little more detail will help.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2009-10-12 13:33:16 Re: Ranking search results using multiple fields in PostgreSQL fulltext search
Previous Message Gaini Rajeshwar 2009-10-12 13:16:02 Ranking search results using multiple fields in PostgreSQL fulltext search