Skip to content

Commit

Permalink
improved search function
Browse files Browse the repository at this point in the history
  • Loading branch information
strobba committed Feb 10, 2024
1 parent e8933eb commit d9808e1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ifk_scb_compilations/search_scb.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,19 @@ def recursive_search(nodes: list) -> None:

return results

def search_substring(self, substring: str):
def search_substring(self, *arg: str):
"""Search for substring in scb db.
Args:
substring: String to search for
entry_ids: a list of list with entry ids
arg: Strings to search for
Returns:
list: elements are tuple with search path and title containing substring
"""
with open(self.search_tree_file_path, "rt") as f:
print(f.readline())
for line in f:
if substring in line:
if all(s.lower() in line.lower() for s in arg):
print(line)

pass
Expand All @@ -87,4 +86,4 @@ def search_substring(self, substring: str):
if __name__ == "__main__":
sSearch = ScbSearch()
# sSearch.update_search_tree()
sSearch.search_substring("region")
sSearch.search_substring("region", "luft")

0 comments on commit d9808e1

Please sign in to comment.