|
@@ -92,10 +92,17 @@ func SearchReport(keyWord string, classifyIdFirsts []int, classifyIdSeconds []in
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
+ filterMustNot := []map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "exists": map[string]interface{}{
|
|
|
+ "field": "BodyContent", //过滤没有内容的报告(晨报和周报)bodyContent 不能为空
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
filterMap := map[string]interface{}{
|
|
|
"bool": map[string]interface{}{
|
|
|
"must": filterMust,
|
|
|
- //"must_not": filterMustNot,
|
|
|
+ "must_not": filterMustNot,
|
|
|
},
|
|
|
}
|
|
|
source := map[string]interface{}{
|
|
@@ -131,13 +138,8 @@ func SearchReport(keyWord string, classifyIdFirsts []int, classifyIdSeconds []in
|
|
|
},
|
|
|
}
|
|
|
fmt.Println(source)
|
|
|
- /*highlight := elastic.NewHighlight()
|
|
|
- highlight = highlight.Fields(elastic.NewHighlighterField("content"), elastic.NewHighlighterField("title"))
|
|
|
- highlight = highlight.PreTags("<font color='red'>").PostTags("</font>")*/
|
|
|
request := global.EsClient.Search(indexName).Source(source) // sets the JSON request
|
|
|
|
|
|
-// searchMap := make(map[string]string)
|
|
|
-
|
|
|
searchResp, err = request.Do(context.Background())
|
|
|
if err != nil {
|
|
|
fmt.Print("结果err:")
|