Thai tone marks and vowels at the end of the search term is wrongly removed. (#29071)

Co-authored-by: sukoom pornsuksiri <sukoom@mm.co.th>
Этот коммит содержится в:
Pattara Kiatisevi
2024-11-21 20:47:48 +07:00
коммит произвёл GitHub
родитель 2e13cbb84d
Коммит f0280d6dd4
4 изменённых файлов: 52 добавлений и 2 удалений

Просмотреть файл

@@ -11,7 +11,7 @@ import (
)
var searchTermPuncStart = regexp.MustCompile(`^[^\pL\d\s#"]+`)
var searchTermPuncEnd = regexp.MustCompile(`[^\pL\d\s*"]+$`)
var searchTermPuncEnd = regexp.MustCompile(`[^\pL\p{M}\d\s*"]+$`)
type SearchParams struct {
Terms string `json:"terms,omitempty"`

Просмотреть файл

@@ -1011,6 +1011,50 @@ func TestParseSearchFlags2(t *testing.T) {
},
},
},
{
Name: "string end with thai upper vowel",
Input: "สวัสดี",
Words: []searchWord{
{
value: "สวัสดี",
exclude: false,
},
},
Flags: []flag{},
},
{
Name: "string end with thai upper tone mark",
Input: "ที่นี่",
Words: []searchWord{
{
value: "ที่นี่",
exclude: false,
},
},
Flags: []flag{},
},
{
Name: "string end with thai upper indication mark",
Input: "การันต์",
Words: []searchWord{
{
value: "การันต์",
exclude: false,
},
},
Flags: []flag{},
},
{
Name: "string end with thai lower vowel",
Input: "กตัญญู",
Words: []searchWord{
{
value: "กตัญญู",
exclude: false,
},
},
Flags: []flag{},
},
} {
t.Run(testCase.Name, func(t *testing.T) {
words, flags := parseSearchFlags(splitWords(testCase.Input))