|
@@ -46,7 +46,7 @@ type ElasticComprehensiveDetail struct {
|
|
|
}
|
|
|
|
|
|
func init() {
|
|
|
- AddComprehensiveArticle()
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -739,10 +739,15 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
mustMap = append(mustMap, map[string]interface{}{
|
|
|
"bool": shouldMap,
|
|
|
})
|
|
|
+
|
|
|
mustNotMap = append(mustNotMap, map[string]interface{}{
|
|
|
- "bool": shouldNotMap,
|
|
|
+ "term": shouldNotMap,
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
queryMap := map[string]interface{}{
|
|
|
"query": map[string]interface{}{
|
|
|
"bool": map[string]interface{}{
|
|
@@ -755,9 +760,9 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
queryMap["from"] = startSize
|
|
|
queryMap["size"] = pageSize
|
|
|
queryMap["highlight"] = highlightMap
|
|
|
- jsonBytes, _ := json.Marshal(queryMap)
|
|
|
- fmt.Println(string(jsonBytes))
|
|
|
- utils.FileLog.Info(string(jsonBytes))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
request := client.Search(indexName).Source(queryMap)
|
|
|
searchByMatch, err := request.Do(context.Background())
|
|
|
if searchByMatch != nil {
|
|
@@ -773,7 +778,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
- fmt.Println(article.SourceId, article.Title, article.Source)
|
|
|
+
|
|
|
searchItem := new(SearchComprehensiveItem)
|
|
|
searchItem.SourceId = article.SourceId
|
|
|
if len(v.Highlight["Annotation"]) > 0 {
|
|
@@ -791,7 +796,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
searchItem.Body = append(searchItem.Body, vText)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ searchItem.IsSummary = article.IsSummary
|
|
|
if len(searchItem.Body) == 0 {
|
|
|
bodyRune := []rune(article.BodyText)
|
|
|
bodyRuneLen := len(bodyRune)
|
|
@@ -825,7 +830,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
uid := user.UserId
|
|
|
-
|
|
|
+ titleHeight := make(map[int]string)
|
|
|
mapItems := make(map[string]*models.CygxResourceDataResp)
|
|
|
for _, v := range list {
|
|
|
|
|
@@ -834,6 +839,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
item.Source = v.Source
|
|
|
if v.IsSummary == 1 {
|
|
|
item.BodyHeight = v.Body
|
|
|
+ titleHeight[v.SourceId] = v.Title
|
|
|
+
|
|
|
} else {
|
|
|
item.BodyHeight = make([]string, 0)
|
|
|
}
|
|
@@ -902,6 +909,9 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
for _, v := range listArticle {
|
|
|
v.Body = ""
|
|
|
v.BodyHtml = ""
|
|
|
+ if titleHeight[v.ArticleId] != "" {
|
|
|
+ v.Title = titleHeight[v.ArticleId]
|
|
|
+ }
|
|
|
mapItems[fmt.Sprint("article", v.ArticleId)].Article = v
|
|
|
}
|
|
|
}
|