fix(memory): sanitize FTS query tokens to handle punctuation
This commit is contained in:
3
app.py
3
app.py
@@ -387,7 +387,8 @@ def search_memories(query: str, limit: int = 5) -> list[dict]:
|
|||||||
if not query.strip():
|
if not query.strip():
|
||||||
return []
|
return []
|
||||||
db = get_db()
|
db = get_db()
|
||||||
words = [w.strip() for w in query.split() if w.strip()]
|
# Use alphanumeric token extraction so punctuation (e.g. '?') cannot break FTS MATCH syntax.
|
||||||
|
words = re.findall(r"[A-Za-z0-9_]+", query)
|
||||||
if not words:
|
if not words:
|
||||||
db.close()
|
db.close()
|
||||||
return []
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user