xyxie 3 ماه پیش
والد
کامیت
70f0cb23fd
1فایلهای تغییر یافته به همراه21 افزوده شده و 6 حذف شده
  1. 21 6
      services/elastic/report.go

+ 21 - 6
services/elastic/report.go

@@ -95,6 +95,11 @@ func SearchReport(keyWord string, classifyIdList []int, pageIndex, pageSize int)
 				},
 			},
 		},
+		map[string]interface{}{
+			"term": map[string]interface{}{
+				"IsPublicPublish": 2, //过滤非公开发布的报告
+			},
+		},
 	}
 	filterMap := map[string]interface{}{
 		"bool": map[string]interface{}{
@@ -226,11 +231,6 @@ func ReportListSearch(keyWord string, classifyIdFirst int, classifyIdSeconds []i
 				"PublishState": 2,
 			},
 		},
-		map[string]interface{}{
-			"term": map[string]interface{}{
-				"IsPublicPublish": 1,
-			},
-		},
 		map[string]interface{}{
 			"term": map[string]interface{}{
 				"ReportChapterId": 0, //排除章节内容
@@ -247,11 +247,26 @@ func ReportListSearch(keyWord string, classifyIdFirst int, classifyIdSeconds []i
 			},
 		},
 	}
+
+	filterMustNot := []map[string]interface{}{
+		map[string]interface{}{
+			"term": map[string]interface{}{
+				"IsPublicPublish": 2, //过滤非公开发布的报告
+			},
+		},
+	}
+
+	filterMap := map[string]interface{}{
+		"bool": map[string]interface{}{
+			"must":     filter,
+			"must_not": filterMustNot,
+		},
+	}
 	source := map[string]interface{}{
 		"query": map[string]interface{}{
 			"bool": map[string]interface{}{
 				"must":   must,
-				"filter": filter,
+				"filter": filterMap,
 			},
 		},
 	}