Skip to content

Commit

Permalink
fix(fst-dict): update dedup and sorting to be hopefully correct
Browse files Browse the repository at this point in the history
  • Loading branch information
grantlemons committed Nov 20, 2024
1 parent ebe01a6 commit 426bd9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions harper-core/src/spell/fst_dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ impl Dictionary for FstDictionary {
))
// Sort by edit distance
.sorted_unstable_by_key(|a| a.0)
.dedup_by(|a, b| a.0 == b.0)
.sorted_unstable_by_key(|a| a.1)
.sorted_by_key(|a| a.1)
.dedup_by(|a, b| a.0 == b.0) // remove the one with the larger distance
.take(max_results)
.map(|(index, edit_distance)| {
let (word, metadata) = &self.words[index as usize];
Expand Down

0 comments on commit 426bd9d

Please sign in to comment.