mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Make word filter regex explicit. Allow hyphen in word filters
Helps with #88
This commit is contained in:
parent
3d86d763c5
commit
afc84de234
1 changed files with 3 additions and 5 deletions
|
@ -1,14 +1,12 @@
|
|||
# Standard Packages
|
||||
import re
|
||||
import time
|
||||
import pickle
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
|
||||
# Internal Packages
|
||||
from src.search_filter.base_filter import BaseFilter
|
||||
from src.utils.helpers import LRU, resolve_absolute_path
|
||||
from src.utils.config import SearchType
|
||||
from src.utils.helpers import LRU
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -16,8 +14,8 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class WordFilter(BaseFilter):
|
||||
# Filter Regex
|
||||
required_regex = r'\+"(\w+)" ?'
|
||||
blocked_regex = r'\-"(\w+)" ?'
|
||||
required_regex = r'\+"([a-zA-Z0-9_-]+)" ?'
|
||||
blocked_regex = r'\-"([a-zA-Z0-9_-]+)" ?'
|
||||
|
||||
def __init__(self, entry_key='raw'):
|
||||
self.entry_key = entry_key
|
||||
|
|
Loading…
Add table
Reference in a new issue