|
@@ -30,7 +30,7 @@ const (
|
|
|
bidSearch_maxPageSize = 10 //招标搜索分页--最大页数
|
|
|
wx_maxPageNum = 20
|
|
|
wx_pageSize = 50
|
|
|
- bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent","projectname"`
|
|
|
+ bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","s_subscopeclass","projectname"`
|
|
|
bidSearch_field = bidSearch_field_1 + `,"detail"`
|
|
|
bidSearch_sort = `{"publishtime":-1}`
|
|
|
)
|
|
@@ -139,7 +139,7 @@ func (m *Front) NewSordfish() error {
|
|
|
return m.SetBody([]byte(ret.(string)))
|
|
|
} else {
|
|
|
m.DisableHttpCache()
|
|
|
- lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","biddingcontent"`, 0, 18)
|
|
|
+ lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","s_subscopeclass"`, 0, 18)
|
|
|
if lastBids != nil && len(*lastBids) > 0 {
|
|
|
jyutil.BidListConvert("", lastBids)
|
|
|
lbnHtml, olHtml := structureLastBidsHtml(lastBids)
|
|
@@ -283,6 +283,8 @@ func (m *Front) Searchinfolist(p string) error {
|
|
|
toptype := m.GetString("toptype")
|
|
|
subtype := m.GetString("subtype")
|
|
|
industry := m.GetString("industry")
|
|
|
+ minprice := m.GetString("minprice") //最低价格
|
|
|
+ maxprice := m.GetString("maxprice") //最高价格
|
|
|
selectType := m.GetString("selectType")
|
|
|
selectTypesess := m.GetSession("selectType")
|
|
|
if selectTypesess != nil && selectTypesess != "" {
|
|
@@ -296,10 +298,10 @@ func (m *Front) Searchinfolist(p string) error {
|
|
|
var list *[]map[string]interface{}
|
|
|
pages := make([]interface{}, 0)
|
|
|
if len(searchvalue) > 0 {
|
|
|
- count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, 0, true, selectType)
|
|
|
+ count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType)
|
|
|
} else if m.Method() == "POST" {
|
|
|
status = 2
|
|
|
- count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, 0, true)
|
|
|
+ count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, false)
|
|
|
} else {
|
|
|
status = 2
|
|
|
if redis.Get("other", "index_list") == nil {
|
|
@@ -318,7 +320,7 @@ func (m *Front) Searchinfolist(p string) error {
|
|
|
}
|
|
|
}
|
|
|
for i := 0; i < 10; i++ {
|
|
|
- count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, intns[i], true)
|
|
|
+ count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, intns[i], true, false)
|
|
|
for k, v := range *list {
|
|
|
v["k"] = (k + 1) + i*50
|
|
|
t := time.Unix(util.Int64All(v["publishtime"]), 0)
|
|
@@ -444,20 +446,22 @@ func (m *Front) PcAjaxReq() {
|
|
|
publishtime := m.GetString("publishtime")
|
|
|
selectType := m.GetString("selectType")
|
|
|
industry := m.GetString("industry")
|
|
|
+ minprice := m.GetString("minprice") //最低价格
|
|
|
+ maxprice := m.GetString("maxprice") //最高价格
|
|
|
m.SetSession("selectType", selectType)
|
|
|
var list *[]map[string]interface{}
|
|
|
var count int64
|
|
|
status, _ := m.GetInteger("status")
|
|
|
if reqType == "filter" {
|
|
|
if status == 1 {
|
|
|
- count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, 0, true, selectType)
|
|
|
+ count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType)
|
|
|
} else if status == 2 {
|
|
|
- count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, 0, true)
|
|
|
+ count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, true)
|
|
|
}
|
|
|
} else if reqType == "bidSearch" {
|
|
|
- count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, start, true, selectType)
|
|
|
+ count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, true, selectType)
|
|
|
} else if reqType == "lastNews" {
|
|
|
- _, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, start, false)
|
|
|
+ _, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, false, true)
|
|
|
}
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
for _, v := range *list {
|
|
@@ -489,11 +493,13 @@ func (m *Front) PcAjaxReq() {
|
|
|
/**
|
|
|
**页面搜索
|
|
|
**/
|
|
|
-func getBidSearchData(searchvalue, area, publishtime, subtype, industry string, start int, isGetCount bool, selectType string) (count int64, list *[]map[string]interface{}) {
|
|
|
- query := getBidSearchQuery(area, publishtime, subtype, industry)
|
|
|
+func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, selectType string) (count int64, list *[]map[string]interface{}) {
|
|
|
//selectType:全文搜索(all)、标题搜索(title)
|
|
|
- var qstr string
|
|
|
- qstr = elastic.GetNgramQuery(searchvalue, query, `"title","detail"` /*FINDF*/)
|
|
|
+ findfields := `"title"`
|
|
|
+ if selectType == "all" {
|
|
|
+ findfields = `"title","detail"`
|
|
|
+ }
|
|
|
+ qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
|
|
|
if isGetCount && qstr != "" {
|
|
|
count = elastic.Count(INDEX, TYPE, qstr)
|
|
|
}
|
|
@@ -501,10 +507,10 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry string,
|
|
|
var repl *[]map[string]interface{}
|
|
|
if selectType == "all" {
|
|
|
//全文搜索
|
|
|
- repl = elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
|
|
|
+ repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, true)
|
|
|
} else {
|
|
|
//标题搜索
|
|
|
- repl = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
|
|
|
+ repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 0, false)
|
|
|
}
|
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
|
jyutil.BidListConvert(industry, repl)
|
|
@@ -517,20 +523,15 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry string,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
-func getLastNewsData(searchvalue, area, publishtime, subtype, industry string, start int, isGetCount bool) (count int64, list *[]map[string]interface{}) {
|
|
|
+func getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, highlight bool) (count int64, list *[]map[string]interface{}) {
|
|
|
//最新招标信息
|
|
|
- query := getBidSearchQuery(area, publishtime, subtype, industry)
|
|
|
- strquery := `{"query":{"bool":{"must":[` + query + `],"must_not":[],"should":[],"minimum_should_match" : 1}}}`
|
|
|
+ findfields := `"title","detail"`
|
|
|
+ qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
|
|
|
if isGetCount {
|
|
|
- count = elastic.Count(INDEX, TYPE, strquery)
|
|
|
- //count = elastic.Count(INDEX, TYPE, elastic.MakeQuery(query, "", "", -1, -1))
|
|
|
+ count = elastic.Count(INDEX, TYPE, qstr)
|
|
|
}
|
|
|
if !isGetCount || count > 0 {
|
|
|
- //repl := elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
|
|
|
- if query == "{}" {
|
|
|
- query = ""
|
|
|
- }
|
|
|
- repl := elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
|
|
|
+ repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, highlight)
|
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
|
jyutil.BidListConvert(industry, repl)
|
|
|
list = repl
|
|
@@ -542,7 +543,7 @@ func getLastNewsData(searchvalue, area, publishtime, subtype, industry string, s
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
-func getBidSearchQuery(area, publishtime, subtype, industry string) string {
|
|
|
+func getBidSearchQuery(area, publishtime, subtype string) string {
|
|
|
query := ``
|
|
|
if area != "" {
|
|
|
query += `{"terms":{"area":[`
|
|
@@ -602,19 +603,6 @@ func getBidSearchQuery(area, publishtime, subtype, industry string) string {
|
|
|
}
|
|
|
query += `]}}`
|
|
|
}
|
|
|
- if industry != "" {
|
|
|
- if len(query) > 0 {
|
|
|
- query += ","
|
|
|
- }
|
|
|
- query += `{"regexp":{"industry":".*(`
|
|
|
- for k, v := range strings.Split(industry, ",") {
|
|
|
- if k > 0 {
|
|
|
- query += `|`
|
|
|
- }
|
|
|
- query += "," + v + ","
|
|
|
- }
|
|
|
- query += `).*"}}`
|
|
|
- }
|
|
|
return query
|
|
|
}
|
|
|
func getLastNewsQuery(area, publishtime, subtype string) string {
|
|
@@ -771,6 +759,8 @@ func (m *Front) Wxsearchlist() error {
|
|
|
toptype := m.GetString("toptype")
|
|
|
subtype := m.GetString("subtype")
|
|
|
industry := m.GetString("industry")
|
|
|
+ minprice := m.GetString("minprice")
|
|
|
+ maxprice := m.GetString("maxprice")
|
|
|
scope := m.GetString("scope")
|
|
|
publishtime := m.GetString("publishtime")
|
|
|
selectType := m.GetString("selectType")
|
|
@@ -778,6 +768,8 @@ func (m *Front) Wxsearchlist() error {
|
|
|
m.SetSession("toptype", toptype)
|
|
|
m.SetSession("subtype", subtype)
|
|
|
m.SetSession("industry", industry)
|
|
|
+ m.SetSession("minprice", minprice)
|
|
|
+ m.SetSession("maxprice", maxprice)
|
|
|
m.SetSession("scope", scope)
|
|
|
m.SetSession("publishtime", publishtime)
|
|
|
var list *[]map[string]interface{}
|
|
@@ -786,7 +778,7 @@ func (m *Front) Wxsearchlist() error {
|
|
|
if selectType == "" { //默认设置为全文搜索
|
|
|
selectType = "all"
|
|
|
}
|
|
|
- list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, 1, selectType)
|
|
|
+ list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, 1, selectType)
|
|
|
|
|
|
r := redis.GetStr("other", "s_"+userid.(string))
|
|
|
arrs := strings.Split(r, ",")
|
|
@@ -831,6 +823,7 @@ func (m *Front) Wxsearchlist() error {
|
|
|
|
|
|
//搜索结果,ajax分页请求
|
|
|
func (m *Front) WxsearchlistPaging() {
|
|
|
+
|
|
|
defer util.Catch()
|
|
|
userid := m.GetSession("userId")
|
|
|
var list *[]map[string]interface{}
|
|
@@ -844,51 +837,53 @@ func (m *Front) WxsearchlistPaging() {
|
|
|
publishtime := m.GetString("publishtime")
|
|
|
selectType := m.GetString("selectType")
|
|
|
industry := m.GetString("industry")
|
|
|
- list = getWxsearchlistData(searchvalue, searchname, scope, publishtime, subtype, industry, pageNum, selectType)
|
|
|
+ minprice := m.GetString("minprice")
|
|
|
+ maxprice := m.GetString("maxprice")
|
|
|
+ list = getWxsearchlistData(searchvalue, searchname, scope, publishtime, subtype, industry, minprice, maxprice, pageNum, selectType)
|
|
|
|
|
|
//历史记录和订阅查询
|
|
|
//if userId := m.GetSession("userId"); userId != nil {
|
|
|
- one, _ := mongodb.FindOneByField("user", bson.M{"_id": bson.ObjectIdHex(userid.(string))}, `{"o_jy":1}`)
|
|
|
- history := redis.GetStr("other", "s_"+userid.(string))
|
|
|
- arrs := strings.Split(history, ",")
|
|
|
+ one, _ := mongodb.FindOneByField("user", bson.M{"_id": bson.ObjectIdHex(userid.(string))}, `{"o_jy":1}`)
|
|
|
+ history := redis.GetStr("other", "s_"+userid.(string))
|
|
|
+ arrs := strings.Split(history, ",")
|
|
|
|
|
|
- if history == "" {
|
|
|
- arrs = make([]string, 0)
|
|
|
- }
|
|
|
- var historyFlag = 0
|
|
|
- for _, v := range arrs {
|
|
|
- if v == strings.Trim(searchvalue, " ") {
|
|
|
- historyFlag = 1
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- if historyFlag != 1 {
|
|
|
- arrs = append(arrs, searchvalue)
|
|
|
- if len(arrs) > 5 {
|
|
|
- arrs = arrs[1:6]
|
|
|
- }
|
|
|
- redis.Del("other", "s_"+userid.(string))
|
|
|
- redis.Put("other", "s_"+userid.(string), strings.Join(arrs, ","), -1)
|
|
|
+ if history == "" {
|
|
|
+ arrs = make([]string, 0)
|
|
|
+ }
|
|
|
+ var historyFlag = 0
|
|
|
+ for _, v := range arrs {
|
|
|
+ if v == strings.Trim(searchvalue, " ") {
|
|
|
+ historyFlag = 1
|
|
|
+ break
|
|
|
}
|
|
|
- l := len(arrs) - 1
|
|
|
- for i := 0; i < len(arrs)/2; i++ {
|
|
|
- tmp := arrs[l-i]
|
|
|
- arrs[l-i] = arrs[i]
|
|
|
- arrs[i] = tmp
|
|
|
+ }
|
|
|
+ if historyFlag != 1 {
|
|
|
+ arrs = append(arrs, searchvalue)
|
|
|
+ if len(arrs) > 5 {
|
|
|
+ arrs = arrs[1:6]
|
|
|
}
|
|
|
- m.T["history"] = arrs
|
|
|
+ redis.Del("other", "s_"+userid.(string))
|
|
|
+ redis.Put("other", "s_"+userid.(string), strings.Join(arrs, ","), -1)
|
|
|
+ }
|
|
|
+ l := len(arrs) - 1
|
|
|
+ for i := 0; i < len(arrs)/2; i++ {
|
|
|
+ tmp := arrs[l-i]
|
|
|
+ arrs[l-i] = arrs[i]
|
|
|
+ arrs[i] = tmp
|
|
|
+ }
|
|
|
+ m.T["history"] = arrs
|
|
|
|
|
|
- if one != nil && len(*one) > 0 {
|
|
|
- o_jy, _ := (*one)["o_jy"].(map[string]interface{})
|
|
|
- a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
- var keys []interface{}
|
|
|
- for _, v := range a_key {
|
|
|
- keyMap, _ := v.(map[string]interface{})
|
|
|
- key, _ := keyMap["key"].([]interface{})
|
|
|
- keys = append(keys, key)
|
|
|
- }
|
|
|
- m.T["msgset"] = keys
|
|
|
+ if one != nil && len(*one) > 0 {
|
|
|
+ o_jy, _ := (*one)["o_jy"].(map[string]interface{})
|
|
|
+ a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
+ var keys []interface{}
|
|
|
+ for _, v := range a_key {
|
|
|
+ keyMap, _ := v.(map[string]interface{})
|
|
|
+ key, _ := keyMap["key"].([]interface{})
|
|
|
+ keys = append(keys, key)
|
|
|
}
|
|
|
+ m.T["msgset"] = keys
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -916,14 +911,19 @@ func (m *Front) DelWxHistorySearch() {
|
|
|
}
|
|
|
|
|
|
//微信端搜索
|
|
|
-func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry string, pageNum int, selectType string) (list *[]map[string]interface{}) {
|
|
|
- query := getBidSearchQuery(scope, publishtime, subtype, industry) //scope是地区对应传进的areas, stype是类型对应scope
|
|
|
+func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice string, pageNum int, selectType string) (list *[]map[string]interface{}) {
|
|
|
+ //scope是地区对应传进的areas, stype是类型对应scope
|
|
|
fmt.Print("keywords>>>", keywords, "searchvalue>>", searchvalue)
|
|
|
+ findfields := `"title"`
|
|
|
+ if selectType == "all" {
|
|
|
+ findfields = `"title","detail"`
|
|
|
+ }
|
|
|
+ qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(scope, publishtime, subtype))
|
|
|
if len(keywords) > 0 {
|
|
|
if selectType == "all" { //全文搜索
|
|
|
- list = elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"`, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, true, false, 100)
|
|
|
+ list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, 100, true)
|
|
|
} else { //标题搜索
|
|
|
- list = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize)
|
|
|
+ list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, 100, false)
|
|
|
}
|
|
|
|
|
|
if list != nil {
|
|
@@ -2048,7 +2048,7 @@ func (f *Front) SearchResult(at, name string) error {
|
|
|
if count1 < startPage || startPage < 0 {
|
|
|
startPage = 0
|
|
|
}
|
|
|
- datas = elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent","projectname"`, startPage, limitcount)
|
|
|
+ datas = elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","s_subscopeclass","projectname"`, startPage, limitcount)
|
|
|
redis.Put("other", "classify_"+name, datas, 2*60*60)
|
|
|
} else {
|
|
|
b, _ := json.Marshal(list)
|
|
@@ -2203,3 +2203,68 @@ func (m *Front) Subscribe() error {
|
|
|
m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
|
|
|
return m.Render("/pc/subscribe.html", &m.T)
|
|
|
}
|
|
|
+
|
|
|
+//获取高级查询所需的参数
|
|
|
+func getShouldQueryMap(findfield, searchvalue, industry string) []map[string]string {
|
|
|
+ mps := []map[string]string{}
|
|
|
+ for _, v := range strings.Split(industry, ",") {
|
|
|
+ mp := map[string]string{}
|
|
|
+ for _, v := range strings.Split(searchvalue, "+") {
|
|
|
+ mp[v] = findfield
|
|
|
+ }
|
|
|
+ mp[v] = "s_subscopeclass"
|
|
|
+ mps = append(mps, mp)
|
|
|
+ }
|
|
|
+ return mps
|
|
|
+}
|
|
|
+
|
|
|
+func getSearchQuery(keyword, industry, minprice, maxprice, findfields, mustquery string) (qstr string) {
|
|
|
+ multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s],"analyzer": "my_ngram"}}`
|
|
|
+ match_phrase := `{"match_phrase": {"s_subscopeclass": "%s"}}`
|
|
|
+ query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
|
|
|
+ query_bool := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
+ rge := `{"range": {"bidamount": {%s}}},{"range": {"budget": {%s}}}`
|
|
|
+ gte := `"gte": %s`
|
|
|
+ lte := `"lte": %s`
|
|
|
+ bools := []string{}
|
|
|
+ if keyword != "" {
|
|
|
+ multi_match = fmt.Sprintf(multi_match, "%s", findfields)
|
|
|
+ shoulds := []string{}
|
|
|
+ for _, v := range strings.Split(keyword, "+") {
|
|
|
+ shoulds = append(shoulds, fmt.Sprintf(multi_match, elastic.ReplaceYH(v)))
|
|
|
+ }
|
|
|
+ bools = append(bools, fmt.Sprintf(elastic.NgramMust, strings.Join(shoulds, ",")))
|
|
|
+ }
|
|
|
+ if industry != "" {
|
|
|
+ shoulds := []string{}
|
|
|
+ for _, v := range strings.Split(industry, ",") {
|
|
|
+ shoulds = append(shoulds, fmt.Sprintf(match_phrase, ","+v+","))
|
|
|
+ }
|
|
|
+ bools = append(bools, fmt.Sprintf(query_bool, strings.Join(shoulds, ",")))
|
|
|
+ }
|
|
|
+ if minprice != "" || maxprice != "" {
|
|
|
+ sq := ``
|
|
|
+ if minprice != "" {
|
|
|
+ min, _ := strconv.ParseFloat(minprice, 64)
|
|
|
+ minprice = fmt.Sprintf("%.0f", min*10000)
|
|
|
+ }
|
|
|
+ if maxprice != "" {
|
|
|
+ max, _ := strconv.ParseFloat(maxprice, 64)
|
|
|
+ maxprice = fmt.Sprintf("%.0f", max*10000)
|
|
|
+ }
|
|
|
+ log.Println(minprice, maxprice)
|
|
|
+ if minprice != "0" {
|
|
|
+ sq += fmt.Sprintf(gte, minprice)
|
|
|
+ }
|
|
|
+ if minprice != "0" && maxprice != "0" {
|
|
|
+ sq += `,`
|
|
|
+ }
|
|
|
+ if maxprice != "0" {
|
|
|
+ sq += fmt.Sprintf(lte, maxprice)
|
|
|
+ }
|
|
|
+ bools = append(bools, fmt.Sprintf(query_bool, fmt.Sprintf(rge, sq, sq)))
|
|
|
+ }
|
|
|
+ qstr = fmt.Sprintf(query, mustquery, strings.Join(bools, ","), len(bools))
|
|
|
+ log.Println("getSearchQuery:", qstr)
|
|
|
+ return
|
|
|
+}
|