mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 21:29:12 +00:00
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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user