|
@@ -34,7 +34,7 @@ type SearchComprehensiveItem struct {
|
|
|
type ElasticComprehensiveDetail struct {
|
|
|
SourceId int `description:"资源ID"`
|
|
|
IsSummary int `description:"是否是纪要"`
|
|
|
- Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior"`
|
|
|
+ Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior 、 产业资源包:industrialsource"`
|
|
|
Title string `description:"标题"`
|
|
|
BodyText string `description:"内容"`
|
|
|
PublishDate string `description:"发布时间"`
|
|
@@ -384,6 +384,9 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
var boost int
|
|
|
//lenkeyWordArr := len(keyWordArr)
|
|
|
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": (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
|
|
|
+ "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": (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
|
|
|
+ "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)
|
|
|
- //condition = ` AND a.chart_id IN (` + utils.GetOrmInReplace(len(newchartIds)) + `)`
|
|
|
- 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
|
|
|
}
|
|
|
}
|
|
|
|