diff --git a/internal/database/sqlite.go b/internal/database/sqlite.go index 1591640..1e0e241 100644 --- a/internal/database/sqlite.go +++ b/internal/database/sqlite.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "strings" _ "modernc.org/sqlite" ) @@ -323,7 +324,11 @@ func (s *SQLiteStore) SearchOptions(ctx context.Context, revisionID int64, query WHERE o.revision_id = ? AND options_fts MATCH ?` - args := []interface{}{revisionID, query} + // Escape the query for FTS5 by wrapping in double quotes for literal matching. + // This prevents special characters (dots, colons, etc.) from being interpreted as operators. + // Also escape any double quotes within the query. + escapedQuery := `"` + strings.ReplaceAll(query, `"`, `""`) + `"` + args := []interface{}{revisionID, escapedQuery} if filters.Type != "" { baseQuery += " AND o.type = ?"