|
@@ -510,7 +510,7 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}) {
|
|
start = 0
|
|
start = 0
|
|
}
|
|
}
|
|
var query = `{"query":{"bool":{"must":[%s],"filter":[%s],"minimum_should_match":1,
|
|
var query = `{"query":{"bool":{"must":[%s],"filter":[%s],"minimum_should_match":1,
|
|
- "should":[{"exists":{"field":"bidamount"}},{"bool":{"should":[{"exists":{"field":"budget"}},{"bool":{"must_not":[{"exists":{"field":"budget"}}]}}],"must_not":[{"exists":{"field":"bidamount"}}]}}]}},"from":"%d","size":"%d","sort":[{"publishtime":{"order":"%s"}}]
|
|
|
|
|
|
+ "should":[{"exists":{"field":"bidamount"}},{"bool":{"should":[{"exists":{"field":"budget"}},{"bool":{"must_not":[{"exists":{"field":"budget"}}]}}],"must_not":[{"exists":{"field":"bidamount"}}]}}]}},"from":"%d","size":"%d","sort":[{"publishtime":{"order":"%s"}}%s]
|
|
}`
|
|
}`
|
|
shouldStr := `{"bool":{"should":[%s]}}`
|
|
shouldStr := `{"bool":{"should":[%s]}}`
|
|
mustArr := []string{}
|
|
mustArr := []string{}
|
|
@@ -552,7 +552,7 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}) {
|
|
}
|
|
}
|
|
if k == 1 {
|
|
if k == 1 {
|
|
if v != "" {
|
|
if v != "" {
|
|
- filterArr = append(filterArr, fmt.Sprint(`{"range":{"publishtime":{"lt":"%d"}}}`, v))
|
|
|
|
|
|
+ filterArr = append(filterArr, fmt.Sprint(`{"range":{"expurasingtime":{"lt":"%d"}}}`, v))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -783,7 +783,12 @@ func SearchList(operator Operator) (int64, *[]map[string]interface{}) {
|
|
if operator.Order == "" {
|
|
if operator.Order == "" {
|
|
operator.Order = "desc"
|
|
operator.Order = "desc"
|
|
}
|
|
}
|
|
- queryStr := fmt.Sprintf(query, strings.Join(mustArr, ","), strings.Join(filterArr, ","), start, operator.PageSize, operator.Order)
|
|
|
|
|
|
+ queryStr := ""
|
|
|
|
+ if operator.Tag == 1 {
|
|
|
|
+ queryStr = fmt.Sprintf(query, strings.Join(mustArr, ","), strings.Join(filterArr, ","), start, operator.PageSize, operator.Order, `,{"expurasingtime":{"order":"asc"}}`)
|
|
|
|
+ } else if operator.Tag == 2 {
|
|
|
|
+ queryStr = fmt.Sprintf(query, strings.Join(mustArr, ","), strings.Join(filterArr, ","), start, operator.PageSize, operator.Order, `,{"bidopentime":{"order":"asc"}}`)
|
|
|
|
+ }
|
|
fmt.Println(queryStr)
|
|
fmt.Println(queryStr)
|
|
start1 := time.Now().Unix()
|
|
start1 := time.Now().Unix()
|
|
fmt.Println(start1)
|
|
fmt.Println(start1)
|