Selaa lähdekoodia

feat:全文搜索

wangshan 3 vuotta sitten
vanhempi
commit
63e5f7c902
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4 4
      jyBXCore/rpc/util/search.go

+ 4 - 4
jyBXCore/rpc/util/search.go

@@ -366,10 +366,10 @@ func GetSearchQuery(in *bxcore.SearchReq, mustquery string) (qstr string) {
 		for _, v := range strings.Split(in.KeyWords, "+") {
 			//标题 全文搜索 搜索类型开关打开 默认搜索全文;(全文包含标题)(单字排除)
 			if switchBool && len([]rune(elastic.ReplaceYH(v))) > 1 {
-				if strings.Contains(findfields, "title,") {
-					findfields = strings.Replace(findfields, "title,", "", -1)
-				} else if strings.Contains(findfields, ",title") {
-					findfields = strings.Replace(findfields, ",title", "", -1)
+				if strings.Contains(findfields, `"title",`) {
+					findfields = strings.Replace(findfields, `"title",`, ``, -1)
+				} else if strings.Contains(findfields, `,"title"`) {
+					findfields = strings.Replace(findfields, `,"title"`, ``, -1)
 				}
 			}
 			keyword_multi_match := fmt.Sprintf(multi_match, "%s", findfields)