|
@@ -134,7 +134,20 @@ func WechatArticleAbstractEsDel(docId string) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func WechatArticleAbstractEsSearch(keywordStr string, tagId, from, size int, sortMap map[string]string) (total int64, list []*WechatArticleAbstractItem, err error) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func WechatArticleAbstractEsSearch(keywordStr string, tagIdList, platformIdList []int, from, size int, sortMap map[string]string) (total int64, list []*WechatArticleAbstractItem, err error) {
|
|
|
indexName := EsWechatArticleAbstractName
|
|
|
list = make([]*WechatArticleAbstractItem, 0)
|
|
|
defer func() {
|
|
@@ -145,8 +158,23 @@ func WechatArticleAbstractEsSearch(keywordStr string, tagId, from, size int, sor
|
|
|
|
|
|
query := elastic.NewBoolQuery()
|
|
|
|
|
|
- if tagId > 0 {
|
|
|
- query = query.Must(elastic.NewTermsQuery("TagIdList", tagId))
|
|
|
+ if len(tagIdList) > 0 {
|
|
|
+ termsList := make([]interface{}, 0)
|
|
|
+ for _, v := range tagIdList {
|
|
|
+ termsList = append(termsList, v)
|
|
|
+ }
|
|
|
+ query = query.Must(elastic.NewTermsQuery("TagIdList", termsList...))
|
|
|
+ }
|
|
|
+ if len(platformIdList) <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ termsList := make([]interface{}, 0)
|
|
|
+ for _, v := range platformIdList {
|
|
|
+ termsList = append(termsList, v)
|
|
|
+ }
|
|
|
+ query = query.Must(elastic.NewTermsQuery("WechatPlatformId", termsList...))
|
|
|
}
|
|
|
|
|
|
|