Эх сурвалжийг харах

Merge branch 'feature/pool325_report_public' into debug

xyxie 6 сар өмнө
parent
commit
d723f4d958

+ 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, //过滤非公开发布的报告
+			},
+		},
 	}
 
 	//某章节的报告,若是继承上一期的报告内容且未作修改,搜索匹配项仅展示最新一期该章节的报告。 需求池p2_838
@@ -233,11 +238,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, //排除章节内容
@@ -254,11 +254,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,
 			},
 		},
 	}