|
@@ -14,7 +14,7 @@ import (
|
|
|
)
|
|
|
|
|
|
// SearchChartInfoData 查询es中的图表数据
|
|
|
-func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds []int, myId int, classifyIds []int, sourceList []string, tagIds []int, isIncludeFile bool, from, size int) (list []*knowledge.KnowledgeResource, total int64, err error) {
|
|
|
+func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds []int, myId int, classifyIds []int, sourceList []string, tagIds []int, isIncludeFile, isQueryRef bool, from, size int) (list []*knowledge.KnowledgeResource, total int64, err error) {
|
|
|
indexName := utils.EsKnowledgeResourceIndexName
|
|
|
list = make([]*knowledge.KnowledgeResource, 0)
|
|
|
defer func() {
|
|
@@ -32,13 +32,6 @@ func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds
|
|
|
"ResourceType": resourceType,
|
|
|
},
|
|
|
})
|
|
|
- if resourceType == knowledge.KnowledgeResourceTypeOpinion {
|
|
|
- mustMap = append(mustMap, map[string]interface{}{
|
|
|
- "term": map[string]interface{}{
|
|
|
- "State": knowledge.KnowledgeResourceStatePassed,
|
|
|
- },
|
|
|
- })
|
|
|
- }
|
|
|
|
|
|
//指标来源
|
|
|
if len(showSysIds) > 0 {
|
|
@@ -90,6 +83,27 @@ func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ if isQueryRef && resourceType == knowledge.KnowledgeResourceTypeOpinion {
|
|
|
+ shouldMap := map[string]interface{}{
|
|
|
+ "should": []interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "term": map[string]interface{}{
|
|
|
+ "State": knowledge.KnowledgeResourceStatePassed,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ map[string]interface{}{
|
|
|
+ "term": map[string]interface{}{
|
|
|
+ "AdminId": myId,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ "minimum_should_match": 1,
|
|
|
+ }
|
|
|
+ mustMap = append(mustMap, map[string]interface{}{
|
|
|
+ "bool": shouldMap,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
if keywordStr != "" {
|
|
|
shouldMap := map[string]interface{}{
|
|
|
"should": []interface{}{
|