by Robin at 20240829 cut zero width unicode

This commit is contained in:
Leufolium 2024-08-29 17:30:14 +08:00
parent 2a12aee170
commit 22aebfe573
2 changed files with 10 additions and 0 deletions

View File

@ -1785,6 +1785,9 @@ func (s *Service) ApiFilterStreamer(ctx *gin.Context, req *streamerproto.ApiFilt
return
}
constellation := util.TrimZeroWidthUnicode(util.DerefString(req.Constellation))
req.Constellation = goproto.String(constellation)
//1.从主播用户表中模糊匹配所有主播信息的用户侧数据按mid正序排序
streameraccts, scores, fullscore, err := _DefaultStreamerAcct.OpFilterStreamerAcct(ctx, &streameracctproto.OpFilterReq{
Age: req.Age,

View File

@ -419,3 +419,10 @@ func CreateKeywordScriptScoreFunction(name string, value string, weight float64)
script := elastic.NewScript(fmt.Sprintf(scriptStr, name, value, 1.0, 0.0))
return elastic.NewScriptFunction(script).Weight(weight)
}
func TrimZeroWidthUnicode(str string) string {
str = strings.Trim(str, "\xe2\x80\x8b")
str = strings.Trim(str, "\xe2\x80\x8c")
str = strings.Trim(str, "\xe2\x80\x8d")
return str
}