Wrap words in quotes to trigger explicit filter from query

- Do not run the more expensive explicit filter until the word to be
  filtered is completed by user. This requires an end sequence marker
  to identify end of explicit word filter to trigger filtering

- Space isn't a good enough delimiter as the explicit filter could be
  at the end of the query in which case no space
This commit is contained in:
Debanjum Singh Solanky
2022-09-04 02:12:56 +03:00
parent 8d9f507df3
commit cdcee89ae5
3 changed files with 7 additions and 7 deletions

View File

@@ -17,8 +17,8 @@ logger = logging.getLogger(__name__)
class ExplicitFilter:
# Filter Regex
required_regex = r'\+([^\s]+) ?'
blocked_regex = r'\-([^\s]+) ?'
required_regex = r'\+"(\w+)" ?'
blocked_regex = r'\-"(\w+)" ?'
def __init__(self, filter_directory, search_type: SearchType, entry_key='raw'):
self.filter_file = resolve_absolute_path(filter_directory / f"{search_type.name.lower()}_explicit_filter_entry_word_sets.pkl")