alist
alist copied to clipboard
feat(search): allow database fulltext index using custom parser
The Ngram Parser can be used directly in MySQL 8.0 and above. In addition, both MySQL and Postgres can utilize various plugins to enhance tokenization for different languages.
This PR adds field Parser string `json:"parser" env:"PARSER"` in conf.Conf.Database to allow admin custom parser for database fulltext index. Although only system admin can set this setting via the config file or environment variables, I want to make it clear that this field is not SQL safe and could be used to implement SQL injection.
The changes in this PR have tested in:
| Tested | Database | Parser | Docker Image |
|---|---|---|---|
| :white_square_button: | Mysql | ngram |
|
| :white_square_button: | Postgres |