Skip to content

Commit

Permalink
Returned 0 since we were always returning 10 anyways
Browse files Browse the repository at this point in the history
  • Loading branch information
scohen committed Apr 23, 2024
1 parent 9929f65 commit 1b1b469
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Lexical.RemoteControl.Search.Fuzzy.Scorer do
2. Patterns that match more consecutive characters
3. Patterns that match the beginning of the subject
4. Patterns that match the case of the subject
5. Patterns that match after the last period
5. Patterns that match the tail of a subject starting at the last period
Based loosely on https://medium.com/@Srekel/implementing-a-fuzzy-search-algorithm-for-the-debuginator-cacc349e6c55
"""
Expand Down Expand Up @@ -187,7 +187,6 @@ defmodule Lexical.RemoteControl.Search.Fuzzy.Scorer do
end

@tail_match_boost 55
@max_match_boost_boost 10

defp match_boost(
%__MODULE__{} = score,
Expand All @@ -204,8 +203,7 @@ defmodule Lexical.RemoteControl.Search.Fuzzy.Scorer do
# and the pattern matches the most local parts
@tail_match_boost
else
# penalize first matches further in the string by making them negative.
max(0 - first_match_position, @max_match_boost_boost)
0
end
end

Expand Down

0 comments on commit 1b1b469

Please sign in to comment.