mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 21:29:12 +00:00
Make word filter regex explicit. Allow hyphen in word filters
Helps with #88
This commit is contained in:
@@ -1,14 +1,12 @@
|
|||||||
# Standard Packages
|
# Standard Packages
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import pickle
|
|
||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.search_filter.base_filter import BaseFilter
|
from src.search_filter.base_filter import BaseFilter
|
||||||
from src.utils.helpers import LRU, resolve_absolute_path
|
from src.utils.helpers import LRU
|
||||||
from src.utils.config import SearchType
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -16,8 +14,8 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class WordFilter(BaseFilter):
|
class WordFilter(BaseFilter):
|
||||||
# Filter Regex
|
# Filter Regex
|
||||||
required_regex = r'\+"(\w+)" ?'
|
required_regex = r'\+"([a-zA-Z0-9_-]+)" ?'
|
||||||
blocked_regex = r'\-"(\w+)" ?'
|
blocked_regex = r'\-"([a-zA-Z0-9_-]+)" ?'
|
||||||
|
|
||||||
def __init__(self, entry_key='raw'):
|
def __init__(self, entry_key='raw'):
|
||||||
self.entry_key = entry_key
|
self.entry_key = entry_key
|
||||||
|
|||||||
Reference in New Issue
Block a user