Skip to content

Sorting of Component Browser Entries #5649

Discussion options

You must be logged in to vote

It does seem that our scoring algorithm does NOT consider the placement of the match in the target text.

Theoretically it should. The code is:

        let is_first_pattern_char = vertex.layer == 0;
        let is_last_pattern_char = text.len().checked_sub(1).contains(&vertex.layer);
        let first_char_bonus = if is_first_pattern_char {
            self.base_weight / (vertex.position_in_text as f32 + 1.0) * self.beginning_weight
        } else {
            0.0
        };
        let last_char_bonus = if is_last_pattern_char {
            self.base_weight / (text.len() - vertex.position_in_text) as f32 * self.ending_weight
        } else {
            0.0
        };

As you see, if we…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by farmaazon
Comment options

You must be logged in to vote
1 reply
@wdanilo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants