|
@@ -111,7 +111,7 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
return fmt.Sprintf(query, doSearchSql)
|
|
|
}
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
- query := `{"query":{"bool":{"must":[%s],"must_not":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
+ query := `{"query":{"bool":{"filter":[%s],"must_not":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
//query := `{"query": {"function_score": {"query": {"bool": {"must": [%s],"must_not": [%s],"should": [%s],"minimum_should_match": %d}},"field_value_factor": {"field": "dataweight","modifier": "ln1p","missing": 0}}}}`
|
|
|
query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
query_bool_should_and := `{"bool":{"should":[%s],"minimum_should_match": 1 %s}}`
|
|
@@ -282,9 +282,23 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
} else if strings.Contains(selectType, ",title") {
|
|
|
selectType = strings.Replace(selectType, ",title", "", -1)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- queryItem = strings.ReplaceAll(selectType, ",", "\",\"")
|
|
|
+ selectMap := map[string]bool{}
|
|
|
+ for _, key := range strings.Split(selectType, ",") {
|
|
|
+ selectMap[key] = true
|
|
|
+ }
|
|
|
+ //todo: 领导说:如果前三个都有,拼语句的时候忽略第四个吧
|
|
|
+ if scd.Comeinfrom == "exportPage" && selectMap["detail"] && selectMap["filetext"] && selectMap["title"] {
|
|
|
+ delete(selectMap, "purchasing")
|
|
|
+ delete(selectMap, "projectname.pname")
|
|
|
+ }
|
|
|
+ if len(selectMap) > 0 {
|
|
|
+ var arr []string
|
|
|
+ for key, _ := range selectMap {
|
|
|
+ arr = append(arr, key)
|
|
|
+ }
|
|
|
+ queryItem = strings.Join(arr, "\",\"")
|
|
|
+ }
|
|
|
}
|
|
|
multi_match_new := fmt.Sprintf(multi_match, "%s", "\""+queryItem+"\"")
|
|
|
|