|
@@ -35,7 +35,7 @@ const (
|
|
|
)
|
|
|
|
|
|
//GetWxsearchlistData 移动端招标信息搜索
|
|
|
-func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, pageNum, pageSize int, selectTypeArr []string, field, notkey string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
|
|
|
+func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, pageNum, pageSize int, selectTypeArr []string, field, notkey string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
|
|
|
var hightlightContent bool = false //是否高亮正文
|
|
|
for _, v := range selectTypeArr {
|
|
|
if v == "detail" {
|
|
@@ -53,7 +53,7 @@ func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minpri
|
|
|
} else {
|
|
|
findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
|
|
|
}
|
|
|
- qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, publishtime, subtype, winner, buyerclass), notkey)
|
|
|
+ qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, city, publishtime, subtype, winner, buyerclass), notkey)
|
|
|
if hightlightContent { //全文搜索
|
|
|
list = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, true)
|
|
|
} else { //标题搜索
|
|
@@ -69,7 +69,7 @@ func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minpri
|
|
|
}
|
|
|
|
|
|
//GetPcBidSearchData pc端招标信息搜索
|
|
|
-func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
|
|
|
+func GetPcBidSearchData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
|
|
|
var findfields string
|
|
|
var hightlightContent bool = false //是否高亮正文
|
|
|
for _, v := range selectTypeArr {
|
|
@@ -83,7 +83,7 @@ func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minpr
|
|
|
} else {
|
|
|
findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
|
|
|
}
|
|
|
- qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass), notkey)
|
|
|
+ qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey)
|
|
|
if isGetCount && qstr != "" && start == 0 {
|
|
|
count = elastic.Count(INDEX, TYPE, qstr)
|
|
|
}
|
|
@@ -107,7 +107,7 @@ func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minpr
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass string) string {
|
|
|
+func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass string) string {
|
|
|
query := ``
|
|
|
if area != "" {
|
|
|
query += `{"terms":{"area":[`
|
|
@@ -119,6 +119,20 @@ func GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass string) st
|
|
|
}
|
|
|
query += `]}}`
|
|
|
}
|
|
|
+ //
|
|
|
+ if city != "" {
|
|
|
+ if len(query) > 0 {
|
|
|
+ query += ","
|
|
|
+ }
|
|
|
+ query += `{"terms":{"city":[`
|
|
|
+ for k, v := range strings.Split(city, ",") {
|
|
|
+ if k > 0 {
|
|
|
+ query += `,`
|
|
|
+ }
|
|
|
+ query += `"` + v + `"`
|
|
|
+ }
|
|
|
+ query += `]}}`
|
|
|
+ }
|
|
|
if publishtime != "" {
|
|
|
if len(query) > 0 {
|
|
|
query += ","
|
|
@@ -333,7 +347,7 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
|
|
|
}
|
|
|
|
|
|
//所有的再次分词查询 只查标题
|
|
|
-func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}) (string, string, string, string, *[]map[string]interface{}) {
|
|
|
+func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}) (string, string, string, string, *[]map[string]interface{}) {
|
|
|
var pcAjaxFlag string
|
|
|
secondSearch := false
|
|
|
var secRel *[]map[string]interface{} = list
|
|
@@ -346,7 +360,7 @@ func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxp
|
|
|
if secondSearch {
|
|
|
if secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address); secondKWS != "" {
|
|
|
findfields := `"title"`
|
|
|
- qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, publishtime, subtype, "", buyerclass), notkey)
|
|
|
+ qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey)
|
|
|
secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, 0, 2*SearchPageSize_PC, 0, false)
|
|
|
if secRel != nil && len(*secRel) > 0 {
|
|
|
public.BidListConvert(industry, secRel)
|
|
@@ -462,21 +476,21 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
|
|
|
return secondList, totalPage, hasNextPage
|
|
|
}
|
|
|
|
|
|
-func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser bool) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
|
|
|
+func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser bool) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
|
|
|
var searchvalue = s_word
|
|
|
number := util.If(platform == "app" || platform == "wx", 1, 0)
|
|
|
if platform == "app" || platform == "wx" {
|
|
|
- list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, SearchPageSize_APP, queryItems, field, notkey)
|
|
|
+ list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, SearchPageSize_APP, queryItems, field, notkey)
|
|
|
if list != nil && len(*list) != 0 {
|
|
|
count = int64(len(*list))
|
|
|
}
|
|
|
} else {
|
|
|
- count, totalPage, list = GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
|
|
|
+ count, totalPage, list = GetPcBidSearchData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
|
|
|
}
|
|
|
|
|
|
if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == number {
|
|
|
var paramList = list
|
|
|
- s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, publishtime, subtype, buyerclass, notkey, queryItems, paramList)
|
|
|
+ s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey, queryItems, paramList)
|
|
|
}
|
|
|
|
|
|
listSize := 0
|
|
@@ -486,12 +500,14 @@ func SearchData(platform string, request *http.Request, currentPage int, userId,
|
|
|
public.SaveUserSearchLog(request, userId, -1, platform, "超级搜索", map[string]interface{}{
|
|
|
"search_word": util.If(platform == "app" || platform == "wx", searchvalue, s_word),
|
|
|
"search_area": area,
|
|
|
+ "search_city": city,
|
|
|
"search_price": []string{minprice, maxprice},
|
|
|
"search_publishtime": publishtime,
|
|
|
"search_type": subtype,
|
|
|
"search_industry": industry,
|
|
|
"pagenum": currentPage,
|
|
|
"pagesize": listSize,
|
|
|
+ "fileExists": fileExists,
|
|
|
})
|
|
|
return
|
|
|
}
|