memorix icon indicating copy to clipboard operation
memorix copied to clipboard

FTS5 syntax errors ( : / - in query tokens) silently swallowed into empty results; search CLI flag/positional inconsistency

Open chenshuangci opened this issue 1 month ago • 1 comments

Environment

  • memorix 1.9.9 CLI

1. FTS5 syntax errors are silently swallowed

Query tokens containing : or - collide with FTS5 query syntax. Searching for content that literally contains such tokens:

  • memorix memory search --query "bug:fixed" → FTS5 MATCH raises no such column: bug
  • memorix memory search --query "db-preflight" → no such column: preflight

The error is caught and the search silently degrades to vector-only; a bare token that doesn't clear the similarity threshold then returns zero results — indistinguishable from "no such memory". This shape is common in my store because observation titles carry a bug:fixed prefix and slugs use - (e.g. a title 【bug:fixed】... [manual-map-row-level-due] is unfindable by its own prefix or slug).

Running the same MATCH expression directly against SQLite reproduces the two errors above verbatim.

Expected

The FTS query builder should quote/escape such tokens (today normalizeFtsToken only escapes double quotes), or the syntax error should surface to the caller instead of silently returning an empty set.

2. Search CLI shape inconsistency

  • memorix search "<query>" takes a positional argument; passing --query errors with Missing required positional.
  • memorix memory search --query "<q>" requires the flag.

Two search commands over the same store should accept the same argument shape.

chenshuangci avatar Oct 08 '26 04:10 chenshuangci

The FTS and CLI search issues are fixed in PR #331.

FTS query construction now treats punctuation-bearing input such as bug:fixed and db-preflight as data, and the memorix search shortcut accepts both a positional query and --query. Focused SQLite FTS and CLI tests cover both behaviors.

AVIDS2 avatar Oct 12 '26 15:10 AVIDS2