wangshan 3 anni fa
parent
commit
ca1b4d511d

+ 1 - 0
jyBXCore/rpc/etc/bxcore.yaml

@@ -19,3 +19,4 @@ LimitSearchText:
   UserIds:
     - 60f4f01156bf6da1bcbbcff6
   Msg: f 开关状态:%s //-2 从配置文件重置,-1 关闭,1 打开<br><br>c 并发数:%d //-2 不限制并发数,-1 无条件直接限制,>0 限制并发数<br><br>t 个人查询限制时间:%ds //-1 不限制<br><br>
+SearchTypeSwitch: true

+ 1 - 0
jyBXCore/rpc/internal/config/config.go

@@ -23,6 +23,7 @@ type Config struct {
 		UserIds    []string
 		Msg        string
 	}
+	SearchTypeSwitch bool
 }
 
 type Db struct {

+ 8 - 0
jyBXCore/rpc/util/search.go

@@ -361,6 +361,14 @@ func GetSearchQuery(in *bxcore.SearchReq, mustquery string) (qstr string) {
 		if strings.Contains(findfields, "filetext") { //搜索范围选择附件,是否有附件条件无效;
 			isFileSearch = true
 		}
+		//标题 全文搜索 搜索类型开关打开 默认搜索全文;(全文包含标题)
+		if strings.Contains(findfields, "detail") && strings.Contains(findfields, "title") && IC.C.SearchTypeSwitch {
+			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)
 		shoulds := []string{}
 		for _, v := range strings.Split(in.KeyWords, "+") {