Prechádzať zdrojové kódy

fix:数据导出分词校验空处理

duxin 3 rokov pred
rodič
commit
3002d9d7cb

+ 20 - 18
src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go

@@ -548,15 +548,16 @@ func GetDataExportIds(elasticAddress string, scd *SieveCondition, checkCount int
 			}
 			if searchTextSize > 3 && num < 50 {
 				if strings.Index(scd.SelectType, "title") > -1 {
-					secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress)
-					scd.Keyword[0].Keyword = secondKWS
-					scd.SelectType = "title"
-					qstr = getDataExportSql(scd)
-					log.Printf("GetDataExportIds-%s-分词查询-sql:%s\n", scd.Id, qstr)
-					res2 := doSearch(qstr, 0, 100, "")
-					res = *delRepeatMapArr(&res, res2)
-					if len(res) > 100 {
-						res = res[:100]
+					if secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress); secondKWS != "" {
+						scd.Keyword[0].Keyword = secondKWS
+						scd.SelectType = "title"
+						qstr = getDataExportSql(scd)
+						log.Printf("GetDataExportIds-%s-分词查询-sql:%s\n", scd.Id, qstr)
+						res2 := doSearch(qstr, 0, 100, "")
+						res = *delRepeatMapArr(&res, res2)
+						if len(res) > 100 {
+							res = res[:100]
+						}
 					}
 				}
 			}
@@ -602,15 +603,16 @@ func GetDataExportSearchResult(bid mg.MongodbSim, bidMgoDBName, elasticAddress s
 			}
 			if searchTextSize > 3 && num < 50 {
 				if strings.Index(scd.SelectType, "title") > -1 {
-					secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress)
-					scd.Keyword[0].Keyword = secondKWS
-					scd.SelectType = "title"
-					qstr = getDataExportSql(scd)
-					log.Printf("GetDataExportSearchResult-%s-分词查询-sql:%s\n", scd.Id, qstr)
-					res2 := doSearch(qstr, 0, 100, "")
-					res = *delRepeatMapArr(&res, res2)
-					if len(res) > 100 {
-						res = res[:100]
+					if secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress); secondKWS != "" {
+						scd.Keyword[0].Keyword = secondKWS
+						scd.SelectType = "title"
+						qstr = getDataExportSql(scd)
+						log.Printf("GetDataExportSearchResult-%s-分词查询-sql:%s\n", scd.Id, qstr)
+						res2 := doSearch(qstr, 0, 100, "")
+						res = *delRepeatMapArr(&res, res2)
+						if len(res) > 100 {
+							res = res[:100]
+						}
 					}
 				}
 			}