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

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема Re: Ranking search results using multiple fields in PostgreSQL fulltext search
Дата
Msg-id 20091012154613.433fd9f1@dawn.webthatworks.it
обсуждение исходный текст
Ответ на Ranking search results using multiple fields in PostgreSQL fulltext search  (Gaini Rajeshwar <raja.rajeshwar2006@gmail.com>)
Ответы Re: Ranking search results using multiple fields in PostgreSQL fulltext search  (Gaini Rajeshwar <raja.rajeshwar2006@gmail.com>)
Список pgsql-general
On Mon, 12 Oct 2009 18:46:02 +0530
Gaini Rajeshwar <raja.rajeshwar2006@gmail.com> 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"

http://www.postgresql.org/docs/current/interactive/textsearch-controls.html

Basically, as you can read in the docs:
- you create a ts_vector concatenating and giving a weight the
  various fields.
- then you compare your ts_vector with
  plainto_tsquery(config, yourinput) @@
  yourpreviouslycomputedts_vector

and order by ts_rank(yourpreviouslycomputedts_vector, yourinput)
(or ts_rank_cd)


--
Ivan Sergio Borgonovo
http://www.webthatworks.it


В списке pgsql-general по дате отправления:

Предыдущее
От: "Naoko Reeves"
Дата:
Сообщение: Cascading of trigger execution level
Следующее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: Re: Ranking search results using multiple fields in PostgreSQL fulltext search