You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provided that I understand the code correctly, the term ranking is sometimes referred to the ranking of an entry and sometimes to a ranking interval which is confusing.
Here a ranking is an arbitrary integer used to rank entries: lib.rs:28
However in initial_interval_index() the from_ranking attribute of the cursor is compared to the ranking interval (i.e. ranking divided by index_interval) in order to get the initial interval index:
lib.rs:235
fn initial_interval_index(
interval_paths: &BTreeMap<i64, Path>,
direction: GetRankingDirection,
maybe_cursor: Option<GetRankingCursor>,
) -> usize {
match maybe_cursor {
None => match direction {
GetRankingDirection::Ascendent => 0,
GetRankingDirection::Descendent => interval_paths.len() - 1,
},
Some(cursor) => {
let ordered_keys: Vec<i64> = interval_paths.keys().into_iter().cloned().collect();
for i in 0..(interval_paths.len() - 1) {
if ordered_keys[i] <= cursor.from_ranking // <<<<<<<<<<< HERE (line 248) <<<<<<<<<<<
&& cursor.from_ranking < ordered_keys[i + 1]
{
return i;
}
}
return 0;
}
}
}
I would propose to either rename from_ranking to from_ranking_interval or actually compare rankings with each other in line 248 by multiplying ordered_keys[i] and ordered_keys[ i+1 ] with self.index_interval. The latter is probably more intuitive for users of the module since they can provide a ranking instead of a ranking interval when specifying a cursor.
The text was updated successfully, but these errors were encountered:
Provided that I understand the code correctly, the term
ranking
is sometimes referred to the ranking of an entry and sometimes to a ranking interval which is confusing.Here a ranking is an arbitrary integer used to rank entries:
lib.rs:28
According to the code below, the leaf of the path is a then a ranking interval, not a ranking.
lib.rs:178
:A cursor has a
from_ranking
attribute:types.rs:18
:However in
initial_interval_index()
thefrom_ranking
attribute of the cursor is compared to the ranking interval (i.e. ranking divided by index_interval) in order to get the initial interval index:lib.rs:235
I would propose to either rename
from_ranking
tofrom_ranking_interval
or actually compare rankings with each other in line 248 by multiplyingordered_keys[i]
andordered_keys[ i+1 ]
withself.index_interval
. The latter is probably more intuitive for users of the module since they can provide a ranking instead of a ranking interval when specifying a cursor.The text was updated successfully, but these errors were encountered: