Skip to content

Commit

Permalink
fix bug: AttributeError: 'Trie' object has no attribute '_search_single'
Browse files Browse the repository at this point in the history
  • Loading branch information
birchkwok committed Oct 1, 2024
1 parent 44deb90 commit 638ea35
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lynse/core_components/fields_cache/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ def search(self, key):
else:
return self._search_single(str(key))

def _search_single(self, key):
node = self.root
for char in key:
if char not in node.children:
return set()
node = node.children[char]
if node.is_end_of_word:
return node.ids
return set()

def _batch_search(self, keys):
results = set()
current_nodes = {self.root: set(keys)}
Expand Down

0 comments on commit 638ea35

Please sign in to comment.