{"html_url": "https://github.com/simonw/datasette/issues/651#issuecomment-579675357", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/651", "id": 579675357, "node_id": "MDEyOklzc3VlQ29tbWVudDU3OTY3NTM1Nw==", "user": {"value": 2181410, "label": "clausjuhl"}, "created_at": "2020-01-29T09:45:00Z", "updated_at": "2021-07-14T19:26:06Z", "author_association": "NONE", "body": "Hi Simon\r\n\r\nThank you for adding the escape_function, but it does not work on my datasette-installation (0.33). I've added the following file to my datasette-dir: `/plugins/sql_functions.py`:\r\n\r\n```python\r\nfrom datasette import hookimpl\r\n\r\ndef escape_fts_query(query):\r\n bits = query.split()\r\n return ' '.join('\"{}\"'.format(bit.replace('\"', '')) for bit in bits)\r\n\r\n@hookimpl\r\ndef prepare_connection(conn):\r\n conn.create_function(\"escape_fts_query\", 1, escape_fts_query)`\r\n```\r\nIt has no effect on the standard queries to the tables though, as they still produce errors when including any characters like '-', '/', '+' or '?'\r\n\r\nDoes the function only work when using costum queries, where I can include the escape_fts-function explicitly in the sql-query?\r\n\r\nPS. I'm calling datasette with --plugins=plugins, and my other plugins work just fine.\r\nPPS. The fts5 virtual table is created with 'sqlite3' like so:\r\n\r\n`CREATE VIRTUAL TABLE \"cases_fts\" USING FTS5(\r\n title,\r\n subtitle,\r\n resume,\r\n suggestion,\r\n presentation,\r\n detail = full,\r\n content_rowid = 'id',\r\n content = 'cases',\r\n tokenize='unicode61', 'remove_diacritics 2', 'tokenchars \"-_\"'\r\n);`\r\n\r\nThanks!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 539590148, "label": "fts5 syntax error when using punctuation"}, "performed_via_github_app": null}