Re: to_tsvector() with hyphens - Mailing list pgsql-general

From Tom Lane
Subject Re: to_tsvector() with hyphens
Date
Msg-id 29462.1436200562@sss.pgh.pa.us
Whole thread Raw
In response to to_tsvector() with hyphens  (Brian DeRocher <brian@derocher.org>)
List pgsql-general
Brian DeRocher <brian@derocher.org> writes:
> But why does to_tsquery() AND them?

> rasmas_hackathon=> select * from to_tsquery( 'gn-foo | bandage' );
>              to_tsquery
> ------------------------------------
>  'gn-foo' & 'gn' & 'foo' | 'bandag'
> (1 row)

Because what you're looking for is gn-foo, not either gn alone or foo
alone.  Converting to "OR" would be the wrong thing.

> The rank is so bad.

> rasmas_hackathon=> select ts_rank_cd( to_tsvector( 'gn series bandage' ), to_tsquery( 'gn-foo | bandage' ) );
>  ts_rank_cd
> ------------
>         0.1
> (1 row)

> Without the hyphen the rank is better, despite the process above.

> rasmas_hackathon=> select ts_rank_cd( to_tsvector( 'gn series bandage' ), to_tsquery( 'gn | bandage' ) );
>  ts_rank_cd
> ------------
>         0.2
> (1 row)

Don't see the problem.  The first case doesn't match the query as well as
the second one does, so I'd fully expect a higher rank for the second.

            regards, tom lane


pgsql-general by date:

Previous
From: Brian DeRocher
Date:
Subject: to_tsvector() with hyphens
Next
From: Adrian Klaver
Date:
Subject: Re: [pg_hba.conf] publish own Python application using PostgreSQL