I think you misunderstood my question. let me give clear idea about what i need.
I am using PostgreSQL fulltext search (tsearch2) feature to implement searching on database. From readings i came to know that we can give weights to different fields in database something like this: *setweight(to_tsvector(title),'A')* Where 'A' is weight given to field title. i can give weights to other fields in the same way. Where the weights 'A', 'B', 'C', 'D' are in will be in the following order *A > B > C > D* according to defalut fulltext search configuration. We can rank the search results using ts_rank function something like this, *ts_rank(tsv_title,ts_query('this is my search text'))* ** But, i want to rank these reults not only based on just title, but also using other fields like summary etc. Is there a way around to do this? On Mon, Oct 12, 2009 at 6:53 PM, Raymond O'Donnell <r...@iol.ie> wrote: > 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 > r...@iol.ie > Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals > ------------------------------------------------------------------ >