Эх сурвалжийг харах

Merge branch 'master' of http://8.136.199.33:3000/cxzhang/hongze_clpt into cygx_9.3.1_0

xingzai 2 жил өмнө
parent
commit
3542c8c3a3

+ 7 - 1
controllers/report.go

@@ -490,7 +490,13 @@ func (this *MobileReportController) List() {
 		}
 		}
 	} else {
 	} else {
 		//获取该产业下所对应的行业图片
 		//获取该产业下所对应的行业图片
-		detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
+		var reportType int
+		if industrialManagementId > 0 {
+			reportType = 2
+		} else {
+			reportType = 1
+		}
+		detail, errCategory := models.GetdetailByCategoryIdOne(categoryId, reportType)
 		if errCategory != nil {
 		if errCategory != nil {
 			br.Msg = "获取信息失败"
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
 			br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)

+ 32 - 4
controllers/search.go

@@ -1,6 +1,7 @@
 package controllers
 package controllers
 
 
 import (
 import (
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
 	"hongze/hongze_clpt/services"
@@ -92,6 +93,8 @@ func (this *MobileSearchController) ListHomeArtAndChart() {
 	if orderColumn == "" {
 	if orderColumn == "" {
 		orderColumn = "Matching"
 		orderColumn = "Matching"
 	}
 	}
+
+	orderColumn = "Matching"
 	//indexName := utils.IndexName
 	//indexName := utils.IndexName
 	//pageSize = 20
 	//pageSize = 20
 	var chartTotal int
 	var chartTotal int
@@ -172,15 +175,40 @@ func (this *MobileSearchController) ListHomeArtAndChart() {
 		//	total = tmpTotal
 		//	total = tmpTotal
 		//	err = tmpErr
 		//	err = tmpErr
 		//}
 		//}
-		tmpResult, tmpTotal, tmpErr := services.EsArticleSearch(keyWord, startSize, pageSize, orderColumn)
-		result = tmpResult
-		total = tmpTotal
-		err = tmpErr
+		_, tmpTotal, err := services.EsArticleSearch(keyWord, startSize, pageSize, orderColumn, 0)
+		if err != nil {
+			br.Msg = "检索失败"
+			br.ErrMsg = "检索失败,Err:" + err.Error()
+			return
+		}
+		tmpResult, tmpTotalResult, err := services.EsArticleSearch(keyWord, startSize, pageSize, orderColumn, 1)
 		if err != nil {
 		if err != nil {
 			br.Msg = "检索失败"
 			br.Msg = "检索失败"
 			br.ErrMsg = "检索失败,Err:" + err.Error()
 			br.ErrMsg = "检索失败,Err:" + err.Error()
 			return
 			return
 		}
 		}
+		result = tmpResult
+		if int(tmpTotalResult) < currentIndex*pageSize {
+			fmt.Println(currentIndex * pageSize)
+			fmt.Println(startSize)
+			fmt.Println(tmpTotalResult)
+			startSizeIk := startSize - int(tmpTotalResult)
+			if startSizeIk < 0 {
+				startSizeIk = 0
+			}
+			var pageSizeIk int
+			pageSizeIk = pageSize - len(tmpResult)
+			tmpResultIk, _, err := services.EsArticleSearch(keyWord, startSizeIk, pageSizeIk, orderColumn, 2)
+			if err != nil {
+				br.Msg = "检索失败"
+				br.ErrMsg = "检索失败,Err:" + err.Error()
+				return
+			}
+			for _, v := range tmpResultIk {
+				result = append(result, v)
+			}
+		}
+		total = tmpTotal
 		if len(result) == 0 {
 		if len(result) == 0 {
 			result = make([]*models.SearchItem, 0)
 			result = make([]*models.SearchItem, 0)
 		}
 		}

+ 13 - 13
models/report_mapping.go

@@ -47,7 +47,7 @@ type TradeReportMappingResp struct {
 	List []*TradeReportMapping
 	List []*TradeReportMapping
 }
 }
 
 
-//获取所有分类
+// 获取所有分类
 func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE 1=1 ORDER BY sort ASC `
 	sql := `SELECT * FROM cygx_report_mapping WHERE 1=1 ORDER BY sort ASC `
@@ -55,7 +55,7 @@ func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 	return
 	return
 }
 }
 
 
-//获取策略下面的所有分类
+// 获取策略下面的所有分类
 func GetReportMappingStrategyHomeAll() (items []*TradeReportMapping, err error) {
 func GetReportMappingStrategyHomeAll() (items []*TradeReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT
 	sql := `SELECT
@@ -75,7 +75,7 @@ ORDER BY
 	return
 	return
 }
 }
 
 
-//行业列表
+// 行业列表
 func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error) {
 func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT
 	sql := `SELECT
@@ -112,7 +112,7 @@ type IndustrialToArticleCategoryListRep struct {
 	AuthInfo               *UserPermissionAuthInfo
 	AuthInfo               *UserPermissionAuthInfo
 }
 }
 
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryId(categoryId int) (item *ReportMapping, err error) {
 func GetdetailByCategoryId(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE  category_id=? LIMIT 1 `
 	sql := `SELECT * FROM cygx_report_mapping WHERE  category_id=? LIMIT 1 `
@@ -120,7 +120,7 @@ func GetdetailByCategoryId(categoryId int) (item *ReportMapping, err error) {
 	return
 	return
 }
 }
 
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryIdPush(categoryId int) (item *ReportMapping, err error) {
 func GetdetailByCategoryIdPush(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=? `
 	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=? `
@@ -128,7 +128,7 @@ func GetdetailByCategoryIdPush(categoryId int) (item *ReportMapping, err error)
 	return
 	return
 }
 }
 
 
-//通过分类ID获取详情主观客观
+// 通过分类ID获取详情主观客观
 func GetdetailByCategoryIdSando(categoryId int) (item *ReportMapping, err error) {
 func GetdetailByCategoryIdSando(categoryId int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_mapping WHERE permission_type>0 AND category_id=?  LIMIT 1`
 	sql := `SELECT * FROM cygx_report_mapping WHERE permission_type>0 AND category_id=?  LIMIT 1`
@@ -136,15 +136,15 @@ func GetdetailByCategoryIdSando(categoryId int) (item *ReportMapping, err error)
 	return
 	return
 }
 }
 
 
-//通过分类ID获取详情
-func GetdetailByCategoryIdOne(categoryId int) (item *ReportMapping, err error) {
+// 通过分类ID获取详情
+func GetdetailByCategoryIdOne(categoryId, reportType int) (item *ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=? LIMIT 1`
-	err = o.Raw(sql, categoryId).QueryRow(&item)
+	sql := `SELECT * FROM cygx_report_mapping WHERE category_id=?   AND report_type = ?   LIMIT 1`
+	err = o.Raw(sql, categoryId, reportType).QueryRow(&item)
 	return
 	return
 }
 }
 
 
-//通过分类ID获取详情
+// 通过分类ID获取详情
 func GetdetailByCategoryIdSet(categoryId int) (ids string, err error) {
 func GetdetailByCategoryIdSet(categoryId int) (ids string, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT
 	sql := `SELECT
@@ -157,7 +157,7 @@ func GetdetailByCategoryIdSet(categoryId int) (ids string, err error) {
 	return
 	return
 }
 }
 
 
-//判断该分类下最新的文章用户是否阅读
+// 判断该分类下最新的文章用户是否阅读
 func CheckThisCategoryNewArticleIsRead(uid, categoryId int) (count int, err error) {
 func CheckThisCategoryNewArticleIsRead(uid, categoryId int) (count int, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count
 	sql := `SELECT COUNT(1) count
@@ -168,7 +168,7 @@ func CheckThisCategoryNewArticleIsRead(uid, categoryId int) (count int, err erro
 	return
 	return
 }
 }
 
 
-//获取策略下面的所有分类
+// 获取策略下面的所有分类
 func GetMatchTypeNamenNotNull() (items []*ReportMapping, err error) {
 func GetMatchTypeNamenNotNull() (items []*ReportMapping, err error) {
 	o := orm.NewOrm()
 	o := orm.NewOrm()
 	sql := `SELECT category_id,match_type_name FROM cygx_report_mapping WHERE match_type_name <> ''`
 	sql := `SELECT category_id,match_type_name FROM cygx_report_mapping WHERE match_type_name <> ''`

+ 36 - 32
services/activity_special.go

@@ -633,49 +633,53 @@ func GetActivitySpecialSearcheList(user *models.WxUserItem, condition string, st
 		err = errors.New("GetActivitySpecialSearcheList, Err: " + e.Error())
 		err = errors.New("GetActivitySpecialSearcheList, Err: " + e.Error())
 		return
 		return
 	}
 	}
-	//return
-
-	// 查询IK分词后那一部分的数据
-	conditionActivityIk, e := GetActivityonditionList(user, "", "", "", "", "", 0, 1, keyword, playBack, 2)
-	if e != nil && e.Error() != utils.ErrNoRow() {
-		err = errors.New("GetActivityonditionList, Err: " + e.Error())
-		return
-	}
-	conditionActivityIk += " AND art.is_limit_people = 1 AND art.publish_status = 1  "
-
-	totalIk, e := models.GetActivityCount(conditionActivityIk, 0, pars, 0)
-	if e != nil {
-		err = errors.New("GetActivityonditionList, Err: " + e.Error())
-		return
-	}
-	//return
-	fmt.Println("totalIk", totalIk)
-	total = totalSearche + totalIk
 	keyWordArr, e := GetIndustryMapNameSliceV3(keywords)
 	keyWordArr, e := GetIndustryMapNameSliceV3(keywords)
 	if e != nil {
 	if e != nil {
 		err = errors.New("GetActivityonditionList, Err: " + e.Error())
 		err = errors.New("GetActivityonditionList, Err: " + e.Error())
 		return
 		return
 	}
 	}
-	keyWordArr = RemoveDuplicatesAndEmpty(keyWordArr)
-	startSizeIk := startSize - totalSearche
-	if startSizeIk < 0 {
-		startSizeIk = 0
-	}
-	var pageSizeIk int
-	pageSizeIk = pageSize - len(list)
-	if pageSizeIk > 0 {
-		//搜索关键词联想
-		conditionActivityIk += ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
-		listIk, e := models.GetActivityListNew(conditionActivityIk, pars, user.UserId, startSizeIk, pageSizeIk, 0, 0, "")
+	var totalIk int
+	if len(keyWordArr) > 1 {
+		// 查询IK分词后那一部分的数据
+		conditionActivityIk, e := GetActivityonditionList(user, "", "", "", "", "", 0, 1, keyword, playBack, 2)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetActivityonditionList, Err: " + e.Error())
+			return
+		}
+		conditionActivityIk += " AND art.is_limit_people = 1 AND art.publish_status = 1  "
+
+		totalIk, e = models.GetActivityCount(conditionActivityIk, 0, pars, 0)
+		if e != nil {
+			err = errors.New("GetActivityonditionList, Err: " + e.Error())
+			return
+		}
+
+		keyWordArr, e := GetIndustryMapNameSliceV3(keywords)
 		if e != nil {
 		if e != nil {
 			err = errors.New("GetActivityonditionList, Err: " + e.Error())
 			err = errors.New("GetActivityonditionList, Err: " + e.Error())
 			return
 			return
 		}
 		}
-		for _, item := range listIk {
-			list = append(list, item)
+		keyWordArr = RemoveDuplicatesAndEmpty(keyWordArr)
+		startSizeIk := startSize - totalSearche
+		if startSizeIk < 0 {
+			startSizeIk = 0
+		}
+		var pageSizeIk int
+		pageSizeIk = pageSize - len(list)
+		if pageSizeIk > 0 {
+			//搜索关键词联想
+			conditionActivityIk += ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
+			listIk, e := models.GetActivityListNew(conditionActivityIk, pars, user.UserId, startSizeIk, pageSizeIk, 0, 0, "")
+			if e != nil {
+				err = errors.New("GetActivityonditionList, Err: " + e.Error())
+				return
+			}
+			for _, item := range listIk {
+				list = append(list, item)
+			}
 		}
 		}
 	}
 	}
-
+	total = totalSearche + totalIk
 	items, e = HandleActivityListButton(list, user)
 	items, e = HandleActivityListButton(list, user)
 	if e != nil {
 	if e != nil {
 		err = errors.New("HandleActivityListButton, Err: " + e.Error())
 		err = errors.New("HandleActivityListButton, Err: " + e.Error())

+ 103 - 10
services/elastic.go

@@ -240,7 +240,7 @@ func EsMultiMatchFunctionScoreQueryTimeSort(indexName, keyWord string, startSize
 	return
 	return
 }
 }
 
 
-func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string) (result []*models.SearchItem, total int64, err error) {
+func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string, ikType int) (result []*models.SearchItem, total int64, err error) {
 	indexName := utils.IndexName
 	indexName := utils.IndexName
 	client := utils.Client
 	client := utils.Client
 	keyWordArr, err := GetIndustryMapNameSliceV3(keyWord)
 	keyWordArr, err := GetIndustryMapNameSliceV3(keyWord)
@@ -250,25 +250,91 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 		keyWordArr = append(keyWordArr, keyWord)
 		keyWordArr = append(keyWordArr, keyWord)
 		keyWordLen = len(keyWordArr)
 		keyWordLen = len(keyWordArr)
 	}
 	}
+	//Es 的高级查询有 自定义排序 文档一时半会儿撸不懂,先做多次查询手动过滤 2023.2.2
+	//ikType 查询方式 ,0:查所有 、 1:查询键入词 、 2:查询除了查询键入词之外的联想词
 	mustMap := make([]interface{}, 0)
 	mustMap := make([]interface{}, 0)
 	shouldMap := make(map[string]interface{}, 0)
 	shouldMap := make(map[string]interface{}, 0)
 	shouldMapquery := make([]interface{}, 0)
 	shouldMapquery := make([]interface{}, 0)
+
+	mustNotMap := make([]interface{}, 0)
+	shouldNotMap := make(map[string]interface{}, 0)
+	shouldNotMapquery := make([]interface{}, 0)
 	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
 	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
 	//keyWordWeight := GetWeight(keyWordLen)
 	//keyWordWeight := GetWeight(keyWordLen)
-	//var boost int
+	var boost int
 	//lenkeyWordArr := len(keyWordArr)
 	//lenkeyWordArr := len(keyWordArr)
-	for _, v := range keyWordArr {
-		//if k == 0 {
-		//	boost = 2 * 1000
-		//} else {
-		//	boost = 1000
-		//}
+	for k, v := range keyWordArr {
+		if k == 0 {
+			boost = 2 * 1000
+		} else {
+			boost = 1
+		}
+
+		//如果是 2:查询除了查询键入词之外的联想词
+		if k == 0 && ikType == 2 {
+			if v != "" {
+				shouldNotMapquery = append(shouldNotMapquery, map[string]interface{}{
+					"function_score": map[string]interface{}{
+						"query": map[string]interface{}{
+							"multi_match": map[string]interface{}{
+								//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+								"boost":  boost, //给查询的值赋予权重
+								"fields": []interface{}{"Title"},
+								"query":  v,
+							},
+						},
+					},
+				})
+				shouldNotMapquery = append(shouldNotMapquery, map[string]interface{}{
+					"function_score": map[string]interface{}{
+						"query": map[string]interface{}{
+							"multi_match": map[string]interface{}{
+								"boost":  boost, //给查询的值赋予权重
+								"fields": []interface{}{"Abstract"},
+								"query":  v,
+							},
+						},
+					},
+				})
+				shouldNotMapquery = append(shouldNotMapquery, map[string]interface{}{
+					"function_score": map[string]interface{}{
+						"query": map[string]interface{}{
+							"multi_match": map[string]interface{}{
+								"boost":  boost, //给查询的值赋予权重
+								"fields": []interface{}{"Annotation"},
+								"query":  v,
+							},
+						},
+					},
+				})
+
+				shouldNotMapquery = append(shouldNotMapquery, 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{}{"BodyText"},
+								"query":  v,
+							},
+						},
+					},
+				})
+			}
+			continue
+		}
+		//如果是 1:查询键入词
+		if k > 0 && ikType == 1 {
+			continue
+		}
+
 		if v != "" {
 		if v != "" {
 			shouldMapquery = append(shouldMapquery, map[string]interface{}{
 			shouldMapquery = append(shouldMapquery, map[string]interface{}{
 				"function_score": map[string]interface{}{
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
 							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
 							"fields": []interface{}{"Title"},
 							"fields": []interface{}{"Title"},
 							"query":  v,
 							"query":  v,
 						},
 						},
@@ -279,7 +345,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 				"function_score": map[string]interface{}{
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
 							"fields": []interface{}{"Abstract"},
 							"fields": []interface{}{"Abstract"},
 							"query":  v,
 							"query":  v,
 						},
 						},
@@ -290,7 +356,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 				"function_score": map[string]interface{}{
 				"function_score": map[string]interface{}{
 					"query": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 						"multi_match": map[string]interface{}{
-							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
 							"fields": []interface{}{"Annotation"},
 							"fields": []interface{}{"Annotation"},
 							"query":  v,
 							"query":  v,
 						},
 						},
@@ -303,6 +369,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 					"query": map[string]interface{}{
 					"query": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 						"multi_match": map[string]interface{}{
 							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
 							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
 							"fields": []interface{}{"BodyText"},
 							"fields": []interface{}{"BodyText"},
 							"query":  v,
 							"query":  v,
 						},
 						},
@@ -314,14 +381,24 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 	shouldMap = map[string]interface{}{
 	shouldMap = map[string]interface{}{
 		"should": shouldMapquery,
 		"should": shouldMapquery,
 	}
 	}
+
+	shouldNotMap = map[string]interface{}{
+		"should": shouldNotMapquery,
+	}
 	//排序
 	//排序
 	sortMap := make([]interface{}, 0)
 	sortMap := make([]interface{}, 0)
+
 	//时间
 	//时间
 	sortMap = append(sortMap, map[string]interface{}{
 	sortMap = append(sortMap, map[string]interface{}{
 		"PublishDate": map[string]interface{}{
 		"PublishDate": map[string]interface{}{
 			"order": "desc",
 			"order": "desc",
 		},
 		},
 	})
 	})
+	//sortMap = append(sortMap, map[string]interface{}{
+	//	"_score": map[string]interface{}{
+	//		"order": "desc",
+	//	},
+	//})
 	//高亮
 	//高亮
 	highlightMap := make(map[string]interface{}, 0)
 	highlightMap := make(map[string]interface{}, 0)
 	highlightMap = map[string]interface{}{
 	highlightMap = map[string]interface{}{
@@ -339,6 +416,10 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 	mustMap = append(mustMap, map[string]interface{}{
 	mustMap = append(mustMap, map[string]interface{}{
 		"bool": shouldMap,
 		"bool": shouldMap,
 	})
 	})
+	mustNotMap = append(mustNotMap, map[string]interface{}{
+		"bool": shouldNotMap,
+	})
+
 	queryMap := map[string]interface{}{
 	queryMap := map[string]interface{}{
 		"query": map[string]interface{}{
 		"query": map[string]interface{}{
 			"bool": map[string]interface{}{
 			"bool": map[string]interface{}{
@@ -346,6 +427,17 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 			},
 			},
 		},
 		},
 	}
 	}
+	//把第一次键入词的筛选条件过滤掉
+	if ikType == 2 {
+		queryMap = map[string]interface{}{
+			"query": map[string]interface{}{
+				"bool": map[string]interface{}{
+					"must":     mustMap,
+					"must_not": mustNotMap,
+				},
+			},
+		}
+	}
 	if orderColumn == "Matching" {
 	if orderColumn == "Matching" {
 		queryMap["sort"] = sortMap
 		queryMap["sort"] = sortMap
 	}
 	}
@@ -354,6 +446,7 @@ func EsArticleSearch(keyWord string, startSize, pageSize int, orderColumn string
 	queryMap["highlight"] = highlightMap
 	queryMap["highlight"] = highlightMap
 	jsonBytes, _ := json.Marshal(queryMap)
 	jsonBytes, _ := json.Marshal(queryMap)
 	fmt.Println(string(jsonBytes))
 	fmt.Println(string(jsonBytes))
+	//utils.FileLog.Info(string(jsonBytes))
 	request := client.Search(indexName).Source(queryMap) // sets the JSON request
 	request := client.Search(indexName).Source(queryMap) // sets the JSON request
 	searchByMatch, err := request.Do(context.Background())
 	searchByMatch, err := request.Do(context.Background())
 	if searchByMatch != nil {
 	if searchByMatch != nil {

+ 3 - 3
utils/config.go

@@ -17,7 +17,7 @@ var (
 	Re          error        //redis错误
 	Re          error        //redis错误
 )
 )
 
 
-//微信配置信息
+// 微信配置信息
 var (
 var (
 	WxId        string //微信原始ID
 	WxId        string //微信原始ID
 	WxAppId     string //查研观向小程序
 	WxAppId     string //查研观向小程序
@@ -45,7 +45,7 @@ var (
 	YiDonggetOriginalLink    string //易董 短连接转为长链接
 	YiDonggetOriginalLink    string //易董 短连接转为长链接
 )
 )
 
 
-//模板消息推送
+// 模板消息推送
 var (
 var (
 	SendWxTemplateMsgUrl string
 	SendWxTemplateMsgUrl string
 )
 )
@@ -99,7 +99,7 @@ func init() {
 		WxOpenAppId = "wx26ccbe242908ed73"                   //公众平台AppId
 		WxOpenAppId = "wx26ccbe242908ed73"                   //公众平台AppId
 		WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8" //公众平台AppSecret
 		WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8" //公众平台AppSecret
 
 
-		IndexName = "cygx_article_v1213"
+		IndexName = "cygx_article_v02_01"
 		ActSendMsgMobile = "15618524605"
 		ActSendMsgMobile = "15618524605"
 	} else {
 	} else {
 		WxPublicAppId = "wx9b5d7291e581233a"                                          //弘则投研公众号 开发者ID(AppID)
 		WxPublicAppId = "wx9b5d7291e581233a"                                          //弘则投研公众号 开发者ID(AppID)