Fix search engine - add json import
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""FTS5 search engine for snippets."""
|
||||
|
||||
import json
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from snip.db.database import Database, get_database
|
||||
@@ -24,7 +26,6 @@ class SearchEngine:
|
||||
|
||||
def highlight(self, text: str, query: str) -> str:
|
||||
"""Add highlighting markers around matched terms."""
|
||||
import re
|
||||
terms = re.split(r'\s+', query)
|
||||
result = text
|
||||
for term in terms:
|
||||
@@ -50,7 +51,6 @@ class SearchEngine:
|
||||
|
||||
def parse_query(self, query: str) -> dict[str, Any]:
|
||||
"""Parse a search query into components."""
|
||||
import re
|
||||
result = {
|
||||
"terms": [],
|
||||
"language": None,
|
||||
|
||||
Reference in New Issue
Block a user