Re: Use full text to rank results higher if they are "closer hit"

From: Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
To: Thomas Nyberg <tomuxiong(at)gmx(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Use full text to rank results higher if they are "closer hit"
Date: 2017-02-14 15:58:45
Message-ID: 624b44dc-f0c3-2d2a-e6b1-513ff37434ed@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14.02.2017 18:57, Artur Zakirov wrote:
>
> Hello,
>
> try the query:
>
> SELECT s, ts_rank(vector, query) AS rank
> FROM t, to_tsvector(s) vector, to_tsquery('hello') query
> WHERE query @@ vector;
> s | rank
> -------------+-----------
> hello | 0.0607927
> hello world | 0.0303964
> (2 rows)

Sorry, the query is:

SELECT s, ts_rank(vector, query, 2) AS rank
FROM t, to_tsvector(s) vector, to_tsquery('hello') query
WHERE query @@ vector;

--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-02-14 16:00:13 Re: Use full text to rank results higher if they are "closer hit"
Previous Message Artur Zakirov 2017-02-14 15:57:13 Re: Use full text to rank results higher if they are "closer hit"