|
@@ -384,6 +384,9 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
var boost int
|
|
|
|
|
|
for k, v := range keyWordArr {
|
|
|
+ if k > 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
if k == 0 {
|
|
|
boost = 2 * 1000
|
|
|
} else {
|
|
@@ -438,6 +441,32 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
},
|
|
|
},
|
|
|
})
|
|
|
+
|
|
|
+ shouldMapquery = append(shouldMapquery, map[string]interface{}{
|
|
|
+ "function_score": map[string]interface{}{
|
|
|
+ "query": map[string]interface{}{
|
|
|
+ "multi_match": map[string]interface{}{
|
|
|
+
|
|
|
+ "boost": boost,
|
|
|
+ "fields": []interface{}{"IndustryName"},
|
|
|
+ "query": v,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ shouldMapquery = append(shouldMapquery, map[string]interface{}{
|
|
|
+ "function_score": map[string]interface{}{
|
|
|
+ "query": map[string]interface{}{
|
|
|
+ "multi_match": map[string]interface{}{
|
|
|
+
|
|
|
+ "boost": boost,
|
|
|
+ "fields": []interface{}{"SubjectNames"},
|
|
|
+ "query": v,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
shouldMap = map[string]interface{}{
|
|
@@ -793,19 +822,37 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if len(industrialResourceIds) > 0 {
|
|
|
pars = make([]interface{}, 0)
|
|
|
-
|
|
|
- pars = append(pars, newchartIds)
|
|
|
|
|
|
+ var industrialResourceIdstring []string
|
|
|
+ for _, v := range industrialResourceIds {
|
|
|
+ industrialResourceIdstring = append(industrialResourceIdstring, strconv.Itoa(v))
|
|
|
+ }
|
|
|
+ industrialId := strings.Join(industrialResourceIdstring, ",")
|
|
|
+ condition = ` AND m.industrial_management_id IN (` + industrialId + `) `
|
|
|
listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIds))
|
|
|
if e != nil {
|
|
|
err = errors.New("GetSearchResourceList, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIds)
|
|
|
+ if e != nil {
|
|
|
+ e = errors.New("GetIndustrialSubjectAllByIndustrialId, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapIndustrial := make(map[string]int)
|
|
|
+ for _, v := range listSubjcet {
|
|
|
+ for k2, v2 := range listIndustrialResourceIds {
|
|
|
+ if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
|
|
|
+ listIndustrialResourceIds[k2].IndustrialSubjectList = append(listIndustrialResourceIds[k2].IndustrialSubjectList, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
for _, v := range listIndustrialResourceIds {
|
|
|
- mapItems[fmt.Sprint("newchart", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
+ mapItems[fmt.Sprint("industrialsource", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
}
|
|
|
}
|
|
|
|