SQLite Forum

Use custom string function in FTS5 match clause
Login
Hi, I build a FTS5 tokenizer to support Chinese and PinYin, and also provide a custom function to generate the match string from user's input.

It all works well except the input contains a single quote, at this case it can't be matched. But if I first `select my_custom_function(input)`, then use the returned value in match clause, it works. Here are the code pieces:

```sql
sqlite> select simple_query('''');
"''"
sqlite> select '    ', simple_highlight(t1, 0, '[', ']') from t1 where x match simple_query('''');
sqlite> select '    ', simple_highlight(t1, 0, '[', ']') from t1 where x match '"''"';
    |@English &special _characters."[']bacon-&and[']-eggs%
```

Please help me on this. Thanks in advance!

* [cpp-example](https://github.com/wangfenjin/simple/blob/master/examples/cpp/main.cc)
* [sql-example](https://github.com/wangfenjin/simple/blob/master/example.sql)
* [repo](https://github.com/wangfenjin/simple)
* [SO question](https://stackoverflow.com/questions/65899743/sqlite-custom-functions-as-match-string)