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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2e13cbb84d
Коммит
f0280d6dd4
@@ -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))
|
||||
|
||||
Ссылка в новой задаче
Block a user