Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4 - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
Date
Msg-id CAKFQuwas8EKUo6UES25K7SWYuyk87RHmuj8aDgYvy_xPOyXshQ@mail.gmail.com
Whole thread Raw
In response to BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17468: Ranking of search results: ts_rank_cd with normalization variant 4