Selaa lähdekoodia

去掉es搜索

xyxie 1 vuosi sitten
vanhempi
commit
0a742c0737
3 muutettua tiedostoa jossa 0 lisäystä ja 121 poistoa
  1. 0 14
      models/data_manage/base_from_yongyi.go
  2. 0 105
      services/elastic/elastic.go
  3. 0 2
      utils/config.go

+ 0 - 14
models/data_manage/base_from_yongyi.go

@@ -34,20 +34,6 @@ type BaseFromYongyiIndexList struct {
 	Paging        *paging.PagingItem `description:"分页数据"`
 }
 
-type EsBaseFromYongyiIndex struct {
-	YongyiIndexId int64
-	IndexCode     string
-	IndexName     string
-	Frequency     string
-	Unit          string
-	ClassifyId    int64
-	StartDate     string
-	EndDate       string
-	TerminalCode  string
-	CreateTime    string
-	ModifyTime    string
-}
-
 type YongyiSingleDataResp struct {
 	YongyiIndexId int
 	ClassifyId    int

+ 0 - 105
services/elastic/elastic.go

@@ -1504,108 +1504,3 @@ func SearchEdbInfoDataByAdminId(indexName, keywordStr string, from, size, filter
 
 	return searchEdbInfoData(indexName, mustMap, mustNotMap, shouldMap, from, size)
 }
-
-// SearchBaseFromYongyiIndex 查询es中的涌溢咨询指标
-func SearchBaseFromYongyiIndex(indexName, keywordStr string, from, size int) (total int64, list []*data_manage.EsBaseFromYongyiIndex, err error) {
-	list = make([]*data_manage.EsBaseFromYongyiIndex, 0)
-	defer func() {
-		if err != nil {
-			fmt.Println("EsAddOrEditData Err:", err.Error())
-		}
-	}()
-	client := utils.EsClient
-
-	highlight := elastic.NewHighlight()
-	highlight = highlight.Fields(elastic.NewHighlighterField("IndexName"))
-	highlight = highlight.PreTags("<font color='red'>").PostTags("</font>")
-
-	mustMap := make([]interface{}, 0)
-
-	//关键字匹配
-	shouldMap := map[string]interface{}{
-		"should": []interface{}{
-			map[string]interface{}{
-				"match": map[string]interface{}{
-					"IndexName": keywordStr,
-				},
-			},
-			// 因为关键词被分了,所以需要用下面的语句来让他 整个词 查询,从而加重整词的权重
-			map[string]interface{}{
-				"match": map[string]interface{}{
-					"IndexName": map[string]interface{}{
-						"query":    keywordStr,
-						"operator": "and",
-					},
-					//"Frequency.keyword": "月度",
-				},
-			},
-		},
-	}
-	mustMap = append(mustMap, map[string]interface{}{
-		"bool": shouldMap,
-	})
-
-	queryMap := map[string]interface{}{
-		"query": map[string]interface{}{
-			"bool": map[string]interface{}{
-				"must": mustMap,
-			},
-		},
-	}
-
-	//根据条件数量统计
-	requestTotalHits := client.Count(indexName).BodyJson(queryMap)
-	total, err = requestTotalHits.Do(context.Background())
-	if err != nil {
-		return
-	}
-
-	// 分页查询
-	queryMap["from"] = from
-	queryMap["size"] = size
-	jsonBytes, _ := json.Marshal(queryMap)
-	fmt.Println(string(jsonBytes))
-
-	request := client.Search(indexName).Highlight(highlight).Source(queryMap) // sets the JSON request
-
-	//requestJson, err := json.Marshal(request)
-	//if err != nil {
-	//	fmt.Println("requestJson err:", err)
-	//}
-	//fmt.Println("requestJson ", string(requestJson))
-	searchMap := make(map[string]string)
-
-	searchResp, err := request.Do(context.Background())
-	if err != nil {
-		return
-	}
-	fmt.Println(searchResp)
-	fmt.Println(searchResp.Status)
-	if searchResp.Status != 0 {
-		return
-	}
-
-	if searchResp.Hits != nil {
-		for _, v := range searchResp.Hits.Hits {
-			if _, ok := searchMap[v.Id]; !ok {
-				itemJson, tmpErr := v.Source.MarshalJSON()
-				if tmpErr != nil {
-					err = tmpErr
-					fmt.Println("movieJson err:", err)
-					return
-				}
-				item := new(data_manage.EsBaseFromYongyiIndex)
-				tmpErr = json.Unmarshal(itemJson, &item)
-				if err != nil {
-					fmt.Println("json.Unmarshal chartInfoJson err:", err)
-					err = tmpErr
-					return
-				}
-
-				list = append(list, item)
-				searchMap[v.Id] = v.Id
-			}
-		}
-	}
-	return
-}

+ 0 - 2
utils/config.go

@@ -110,7 +110,6 @@ var (
 	EsEnglishReportIndexName       string //英文研报ES索引
 	MY_CHART_INDEX_NAME            string //研究图库(MY ETA)索引
 	EsSemanticAnalysisDocIndexName string //ES语义分析文档索引名
-	EsIndexBaseFromYongyiIndex     string //数据源涌溢咨询指标
 	SmartReportIndexName           string //智能研报ES索引
 )
 
@@ -435,7 +434,6 @@ func init() {
 		EsEnglishReportIndexName = config["es_english_report_index_name"]
 		EsSemanticAnalysisDocIndexName = config["es_semantic_analysis_doc_index_name"]
 		SmartReportIndexName = config["es_smart_report_index_name"]
-		EsIndexBaseFromYongyiIndex = config["es_index_base_from_yongyi_index"]
 	}
 
 	CrmEtaServerUrl = config["crm_eta_server_url"]