Re: [GENERAL] Use full text to rank results higher if they are "closer hit" - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Use full text to rank results higher if they are "closer hit"
Date
Msg-id 11992.1487088246@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] Use full text to rank results higher if they are "closer hit"  (Thomas Nyberg <tomuxiong@gmx.com>)
Responses Re: [GENERAL] Use full text to rank results higher if they are"closer hit"  (Thomas Nyberg <tomuxiong@gmx.com>)
List pgsql-general
Thomas Nyberg <tomuxiong@gmx.com> writes:
> Here both 'hello' and 'hello world' are ranked equally highly when
> searching with 'hello'. What I'm wondering is, is there a way within
> postgres to have it match higher to just 'hello' than 'hello world'?
> I.e. something like it slightly down-weights extraneous terms? Of course
> in general I don't know the query or the field strings ahead of time.

Read the documentation for ts_rank --- there's a normalization option
for that.

I'd also suggest you might prefer using ts_rank_cd, which is supposed to
penalize cases where the matching words aren't close together.

            regards, tom lane


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] Use full text to rank results higher if they are"closer hit"
Next
From: Thomas Nyberg
Date:
Subject: Re: [GENERAL] Use full text to rank results higher if they are"closer hit"