alist icon indicating copy to clipboard operation
alist copied to clipboard

feat(search): allow database fulltext index using custom parser

Open Mmx233 opened this issue 1 year ago • 0 comments

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

Mmx233 avatar Aug 24 '24 15:08 Mmx233