File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -479,15 +479,16 @@ async def make_search_query(self, search: str):
479479 """
480480 Given a search term, construct a human-friendly search against multiple fields.
481481 """
482- search_str = re . escape ( search .strip ().lower () )
482+ search_str = search .strip ().lower ()
483483 if not search_str :
484484 return None
485+ search_str_escaped = re .escape (search_str )
485486 return {
486487 "$or" : [
487488 {"$text" : {"$search" : search_str }},
488- {"host_parts" : {"$regex" : f"^{ search_str } " }},
489- {"host" : {"$regex" : f"^{ search_str } $ " }},
490- {"reverse_host" : {"$regex" : f"^{ search_str [::- 1 ]} $ " }},
489+ {"host_parts" : {"$regex" : f"^{ search_str_escaped } " }},
490+ {"host" : {"$regex" : f"^{ search_str_escaped } " }},
491+ {"reverse_host" : {"$regex" : f"^{ re . escape ( search_str [::- 1 ]) } " }},
491492 ]
492493 }
493494
You can’t perform that action at this time.
0 commit comments