Compare commits

..

2 commits

Author SHA1 Message Date
fbe470a5ec Add Trie post
All checks were successful
ci/woodpecker/push/deploy/2 Pipeline was successful
ci/woodpecker/cron/deploy/2 Pipeline was successful
2024-07-04 15:12:25 +00:00
3f56870aa1 posts: trie: add fuzzy matching 2024-07-04 15:12:24 +00:00

View file

@ -164,8 +164,8 @@ def get_fuzzy(self, key: str, max_distance: int = 0) -> Iterator[FuzzyResult[T]]
row = list(range(len(key) + 1))
# Base case for the empty string
if (distance := row[-1]) <= max_distance and self._value != None:
yield FuzzyResult(distance, "", self._value)
if (distance := row[-1]) <= max_distance and node._value != None:
yield FuzzyResult(distance, "", node._value)
for c, child in self._children.items():
yield from helper(c, child, row)
```