|
@@ -2936,7 +2936,6 @@ func getDataExportSql(keywords []KeyWord, industry []string, minprice string, ma
|
|
}
|
|
}
|
|
mustquery += `]}}`
|
|
mustquery += `]}}`
|
|
}
|
|
}
|
|
- log.Println("query__1_____\n", mustquery)
|
|
|
|
|
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s],"analyzer": "my_ngram"}}`
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s],"analyzer": "my_ngram"}}`
|
|
query := `{"query":{"bool":{"must":[%s],"should":[%s],"must_not":[%s],"minimum_should_match": %d}}}`
|
|
query := `{"query":{"bool":{"must":[%s],"should":[%s],"must_not":[%s],"minimum_should_match": %d}}}`
|
|
@@ -2979,18 +2978,14 @@ func getDataExportSql(keywords []KeyWord, industry []string, minprice string, ma
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- log.Printf("query__2_____\n %s \n %s", bools, must_not)
|
|
|
|
if len(industry) > 0 {
|
|
if len(industry) > 0 {
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "s_subscopeclass", `"`+strings.Join(industry, `","`)+`"`))
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "s_subscopeclass", `"`+strings.Join(industry, `","`)+`"`))
|
|
- log.Printf("query__3_____\n %s ", fmt.Sprintf(query_bool_must, "s_subscopeclass", `"`+strings.Join(industry, `","`)+`"`))
|
|
|
|
}
|
|
}
|
|
if len(buyer) > 0 {
|
|
if len(buyer) > 0 {
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "buyer", `"`+strings.Join(buyer, `","`)+`"`))
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "buyer", `"`+strings.Join(buyer, `","`)+`"`))
|
|
- log.Printf("query__4_____\n %s ", fmt.Sprintf(query_bool_must, "buyer", `"`+strings.Join(buyer, `","`)+`"`))
|
|
|
|
}
|
|
}
|
|
if len(winner) > 0 {
|
|
if len(winner) > 0 {
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "s_winner", `"`+strings.Join(winner, `","`)+`"`))
|
|
bools = append(bools, fmt.Sprintf(query_bool_must, "s_winner", `"`+strings.Join(winner, `","`)+`"`))
|
|
- log.Printf("query__5_____\n %s ", fmt.Sprintf(query_bool_must, "s_winner", `"`+strings.Join(winner, `","`)+`"`))
|
|
|
|
}
|
|
}
|
|
if minprice != "" || maxprice != "" {
|
|
if minprice != "" || maxprice != "" {
|
|
sq := ``
|
|
sq := ``
|
|
@@ -3019,11 +3014,8 @@ func getDataExportSql(keywords []KeyWord, industry []string, minprice string, ma
|
|
}
|
|
}
|
|
query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq, sq))
|
|
query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq, sq))
|
|
bools = append(bools, query_price)
|
|
bools = append(bools, query_price)
|
|
- log.Printf("query__6_____\n %s ", query_price)
|
|
|
|
}
|
|
}
|
|
- log.Println("must_not", must_not)
|
|
|
|
qstr := fmt.Sprintf(query, mustquery, strings.Join(bools, ","), strings.Join(must_not, ","), len(bools)+len(must_not))
|
|
qstr := fmt.Sprintf(query, mustquery, strings.Join(bools, ","), strings.Join(must_not, ","), len(bools)+len(must_not))
|
|
- log.Println("\n", qstr)
|
|
|
|
return qstr
|
|
return qstr
|
|
}
|
|
}
|
|
func stringMForm(s string) string {
|
|
func stringMForm(s string) string {
|