|
@@ -62,6 +62,13 @@ var onceSearchCount = 500
|
|
|
var ExportTable string = "export_search"
|
|
|
var searchPool = make(chan bool, 8)
|
|
|
|
|
|
+var topType = map[string]string{
|
|
|
+ "招标预告": "预告",
|
|
|
+ "招标公告": "招标",
|
|
|
+ "招标结果": "结果",
|
|
|
+ "招标信用信息": "其他",
|
|
|
+}
|
|
|
+
|
|
|
//获取数据导出查询语句
|
|
|
func getDataExportSql(scd *SieveCondition) string {
|
|
|
if len(scd.SelectIds) > 0 {
|
|
@@ -149,14 +156,25 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
musts = append(musts, timequery)
|
|
|
|
|
|
if scd.Subtype != "" {
|
|
|
- subquery := `{"terms":{"subtype":[`
|
|
|
- for k, v := range strings.Split(scd.Subtype, ",") {
|
|
|
- if k > 0 {
|
|
|
- subquery += `,`
|
|
|
+ var subquery string
|
|
|
+ var topTypes []string
|
|
|
+ var subTypes []string
|
|
|
+
|
|
|
+ for _, v := range strings.Split(scd.Subtype, ",") {
|
|
|
+ if v1, ok := topType[v]; ok {
|
|
|
+ topTypes = append(topTypes, fmt.Sprintf(`"%s"`, v1))
|
|
|
+ } else {
|
|
|
+ subTypes = append(subTypes, fmt.Sprintf(`"%s"`, v))
|
|
|
}
|
|
|
- subquery += `"` + v + `"`
|
|
|
}
|
|
|
- subquery += `]}}`
|
|
|
+ log.Println("信息类型搜索:", topTypes, subTypes)
|
|
|
+ if len(subTypes) > 0 && len(topTypes) > 0 {
|
|
|
+ subquery = fmt.Sprintf(`{"bool": {"should": [{"terms": {"subtype": [%s]}},{"terms": {"toptype": [%s]}}]}}`, strings.Join(subTypes, ","), strings.Join(topTypes, ","))
|
|
|
+ } else if len(subTypes) > 0 {
|
|
|
+ subquery = fmt.Sprintf(`{"terms":{"subtype":[%s]}}`, strings.Join(subTypes, ","))
|
|
|
+ } else if len(topTypes) > 0 {
|
|
|
+ subquery = fmt.Sprintf(`{"terms":{"toptype":[%s]}}`, strings.Join(topTypes, ","))
|
|
|
+ }
|
|
|
musts = append(musts, subquery)
|
|
|
}
|
|
|
if len(scd.Industry) > 0 {
|