pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
5+ messages / 3 participants
[nested] [flat]
* BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
@ 2022-04-25 20:18 PG Bug reporting form <noreply@postgresql.org>
2022-04-25 21:18 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: PG Bug reporting form @ 2022-04-25 20:18 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: vicreal@yandex.ru
The following bug has been logged on the website:
Bug reference: 17468
Logged by: vicreal
Email address: vicreal@yandex.ru
PostgreSQL version: 13.1
Operating system: Debian 10
Description:
Test 1
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function | calculates'), 4); -- 0.1
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function'), 4); -- 0.1
Test 2
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function | calculates'), 1); -- 0.124
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function'), 1); -- 0.062
Test 3
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function | calculates'), 4|1); -- 0.062 (X)
SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
density'), to_tsquery('function'), 4|1); -- 0.062 (Y)
How it should be:
1) In test 3 rank Y should be smaller, than rank X (as in test 2).
2) How get difference ranks Y < X when using normalization variant 4 ?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
2022-04-25 20:18 BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 PG Bug reporting form <noreply@postgresql.org>
@ 2022-04-25 21:18 ` David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 21:34 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 Артем Александров <vicreal@yandex.ru>
0 siblings, 1 reply; 5+ messages in thread
From: David G. Johnston @ 2022-04-25 21:18 UTC (permalink / raw)
To: vicreal@yandex.ru, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, Apr 25, 2022 at 2:03 PM PG Bug reporting form <
noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17468
> Logged by: vicreal
> Email address: vicreal@yandex.ru
> PostgreSQL version: 13.1
> Operating system: Debian 10
> Description:
>
>
> Test 3
> SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
> density'), to_tsquery('function | calculates'), 4|1); -- 0.062 (X)
> SELECT ts_rank_cd(to_tsvector('This function calculates the coverage
> density'), to_tsquery('function'), 4|1); -- 0.062 (Y)
>
> How it should be:
> 1) In test 3 rank Y should be smaller, than rank X (as in test 2).
>
> 2) How get difference ranks Y < X when using normalization variant 4 ?
>
Why are you writing the number 5 as "4|1" (4 "bitwise or" 1) in Test 3?
David J.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
2022-04-25 20:18 BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 PG Bug reporting form <noreply@postgresql.org>
2022-04-25 21:18 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
@ 2022-04-25 21:34 ` Артем Александров <vicreal@yandex.ru>
2022-04-25 21:47 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Артем Александров @ 2022-04-25 21:34 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
<div><div><div>> Why are you writing the number 5 as "4|1" (4 "bitwise or" 1) in Test 3?</div><div> </div></div><div>According to the reference: "<em>The integer option controls several behaviors, so it is a bit mask: you can specify one or more behaviors using </em><code><em>|</em></code><em> (for example, </em><code><em>2|4</em></code><em>)</em>".</div><div> </div><div><div><strong>The task is as follows</strong>:</div><div><strong>1)</strong> use normalization option 4 (document rank is divided by the average harmonic distance between blocks)</div><div><strong>2)</strong> in test 3, get the result Y < X</div><div> </div><div>How to solve this problem ?</div></div><div> </div><div> </div></div><div> </div><div>26.04.2022, 00:18, "David G. Johnston" <david.g.johnston@gmail.com>:</div><blockquote><div><div><div style="font-family:'arial' , 'helvetica' , sans-serif"><span style="font-family:'arial' , 'helvetica' , sans-serif">On Mon, Apr 25, 2022 at 2:03 PM PG Bug reporting form <<a href="mailto:noreply@postgresql.org" rel="noopener noreferrer">noreply@postgresql.org</a>> wrote:</span></div></div><div><blockquote style="border-left-color:rgb( 204 , 204 , 204 );border-left-style:solid;border-left-width:1px;margin:0px 0px 0px 0.8ex;padding-left:1ex">The following bug has been logged on the website:<br /><br />Bug reference: 17468<br />Logged by: vicreal<br />Email address: <a href="mailto:vicreal@yandex.ru" rel="noopener noreferrer" target="_blank">vicreal@yandex.ru</a><br />PostgreSQL version: 13.1<br />Operating system: Debian 10<br />Description: <br /> </blockquote><div> </div><blockquote style="border-left-color:rgb( 204 , 204 , 204 );border-left-style:solid;border-left-width:1px;margin:0px 0px 0px 0.8ex;padding-left:1ex">Test 3<br />SELECT ts_rank_cd(to_tsvector('This function calculates the coverage<br />density'), to_tsquery('function | calculates'), 4|1); -- 0.062 (X)<br />SELECT ts_rank_cd(to_tsvector('This function calculates the coverage<br />density'), to_tsquery('function'), 4|1); -- 0.062 (Y)<br /><br />How it should be:<br />1) In test 3 rank Y should be smaller, than rank X (as in test 2).<br /><br />2) How get difference ranks Y < X when using normalization variant 4 ?</blockquote><div> </div><div style="font-family:'arial' , 'helvetica' , sans-serif">Why are you writing the number 5 as "4|1" (4 "bitwise or" 1) in Test 3?</div><div style="font-family:'arial' , 'helvetica' , sans-serif"> </div><div style="font-family:'arial' , 'helvetica' , sans-serif">David J.</div><div style="font-family:'arial' , 'helvetica' , sans-serif"> </div></div></div></blockquote>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
2022-04-25 20:18 BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 PG Bug reporting form <noreply@postgresql.org>
2022-04-25 21:18 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 21:34 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 Артем Александров <vicreal@yandex.ru>
@ 2022-04-25 21:47 ` David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 22:13 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: David G. Johnston @ 2022-04-25 21:47 UTC (permalink / raw)
To: Артем Александров <vicreal@yandex.ru>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, Apr 25, 2022 at 2:34 PM Артем Александров <vicreal@yandex.ru> wrote:
> > Why are you writing the number 5 as "4|1" (4 "bitwise or" 1) in Test 3?
>
> According to the reference: "*The integer option controls several
> behaviors, so it is a bit mask: you can specify one or more behaviors using
> **|** (for example, **2|4**)*".
>
>
I was so surprised by the use of a bitmap here I didn't get that far, my
bad.
*The task is as follows*:
> *1)* use normalization option 4 (document rank is divided by the average
> harmonic distance between blocks)
> *2)* in test 3, get the result Y < X
>
>
You are first using normalization option 1 (divide rank by 1+ log(len))
Then, for option 4, divide that first result by "mean harmonic distance
between extents" - I have no idea how to do that off the top of my head...
"If more than one flag bit is specified, the transformations are applied in
the order listed."
The listed order is the documented order, not the order you specify. The
function has no way of to know whether the 5 it received was presented as
5, 1|4, or 4|1
We are open source if you want to demonstrate specifically, using numbers,
where the error in the calculation is and, ideally, where it happens in the
code. I don't know enough to say with the information given whether your
assertion of a bug is correct or a mis-understanding on your part.
David J.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
2022-04-25 20:18 BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 PG Bug reporting form <noreply@postgresql.org>
2022-04-25 21:18 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 21:34 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 Артем Александров <vicreal@yandex.ru>
2022-04-25 21:47 ` Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 David G. Johnston <david.g.johnston@gmail.com>
@ 2022-04-25 22:13 ` David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: David G. Johnston @ 2022-04-25 22:13 UTC (permalink / raw)
To: Артем Александров <vicreal@yandex.ru>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, Apr 25, 2022 at 2:47 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:
> We are open source if you want to demonstrate specifically, using numbers,
> where the error in the calculation is and, ideally, where it happens in the
> code. I don't know enough to say with the information given whether your
> assertion of a bug is correct or a mis-understanding on your part.
>
If I don't normalize at all the queries have ranks of: 0.2 and 0.1
(two-word and single-word respectively)
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2022-04-25 22:13 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 20:18 BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 PG Bug reporting form <noreply@postgresql.org>
2022-04-25 21:18 ` David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 21:34 ` Артем Александров <vicreal@yandex.ru>
2022-04-25 21:47 ` David G. Johnston <david.g.johnston@gmail.com>
2022-04-25 22:13 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox