|
@@ -62,8 +62,8 @@ func FilteKey(k string) string {
|
|
|
return k
|
|
|
}
|
|
|
|
|
|
-//超过keywordsLimit个字,截断
|
|
|
-//返回截取后的字符串和截取掉中的前3个字
|
|
|
+// 超过keywordsLimit个字,截断
|
|
|
+// 返回截取后的字符串和截取掉中的前3个字
|
|
|
func InterceptSearchKW(word string, keywordsLimit int, isFilter bool) (b_word, a_word, s_word string) {
|
|
|
if isFilter {
|
|
|
word = FilteKey(word)
|
|
@@ -129,7 +129,6 @@ func HttpEs(ques, analyzer, esAddress string) (res string) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
func getesResp(ques, analyzer string, addrs []string) (resp *http.Response, err error) {
|
|
|
for _, v := range addrs {
|
|
|
surl := v + "/bidding/_analyze"
|
|
@@ -156,8 +155,9 @@ const (
|
|
|
//招标搜索分页--每页显示数量
|
|
|
SearchPageSize = 50
|
|
|
//招标搜索分页--最大页数
|
|
|
- SearchMaxPageNum = 10 //免费用户500条记录
|
|
|
- SearchMaxPageNum_PAYED = 100 //付费用户5000条记录
|
|
|
+ SearchMaxPageNum = 10 //免费用户500条记录
|
|
|
+ SearchMaxPageNum_PAYED = 100 //付费用户5000条记录
|
|
|
+ SearchMaxPageCount_NOLOGIN = 5000 //未登录用户5000条记录
|
|
|
|
|
|
bidSearch_field_1 = `"_id","title","publishtime","dataweight","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site"` //,"filetext"
|
|
|
bidSearch_field = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
|
|
@@ -165,7 +165,7 @@ const (
|
|
|
query_bool_should = `{"bool":{"should":[%s],"minimum_should_match": 1}}`
|
|
|
)
|
|
|
|
|
|
-//GetBidSearchData 标信息搜索
|
|
|
+// GetBidSearchData 标信息搜索
|
|
|
func GetBidSearchData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchList) {
|
|
|
t := time.Now()
|
|
|
var hightlightContent bool = false //是否高亮正文
|
|
@@ -216,7 +216,6 @@ func GetBidSearchData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchL
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
var topTypeMap = map[string]string{
|
|
|
"招标预告": "预告",
|
|
|
"招标公告": "招标",
|
|
@@ -226,7 +225,6 @@ var topTypeMap = map[string]string{
|
|
|
"采购意向": "采购意向",
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
func GetBidSearchQuery(in *bxcore.SearchReq) string {
|
|
|
query := ``
|
|
|
//省份
|
|
@@ -340,7 +338,7 @@ func GetBidSearchQuery(in *bxcore.SearchReq) string {
|
|
|
return query
|
|
|
}
|
|
|
|
|
|
-//包含正文或 附件 不包含标题
|
|
|
+// 包含正文或 附件 不包含标题
|
|
|
func DetailFileORTitle(findfields string) bool {
|
|
|
return (strings.Contains(findfields, `"detail"`) || strings.Contains(findfields, `"filetext"`)) && !strings.Contains(findfields, `"title"`)
|
|
|
}
|
|
@@ -549,7 +547,7 @@ func BidListConvert(industry string, res *[]map[string]interface{}) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//是否收藏
|
|
|
+// 是否收藏
|
|
|
func MakeCollection(userId string, list []*bxcore.SearchList) {
|
|
|
if list == nil || len(list) == 0 {
|
|
|
return
|
|
@@ -579,7 +577,7 @@ func MakeCollection(userId string, list []*bxcore.SearchList) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//默认查询缓存数据
|
|
|
+// 默认查询缓存数据
|
|
|
func SearchCahcheData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchList) {
|
|
|
//最新招标信息
|
|
|
findfields := `"title"`
|
|
@@ -598,7 +596,7 @@ func SearchCahcheData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchL
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//格式化数据
|
|
|
+// 格式化数据
|
|
|
func searchListFormart(repl *[]map[string]interface{}, b bool) (list []*bxcore.SearchList) {
|
|
|
for _, v := range *repl {
|
|
|
var searchList = &bxcore.SearchList{}
|
|
@@ -648,7 +646,7 @@ func searchListFormart(repl *[]map[string]interface{}, b bool) (list []*bxcore.S
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//合并map数据,去重,排序
|
|
|
+// 合并map数据,去重,排序
|
|
|
func DelRepeatSearchData(resOne, resTwo []*bxcore.SearchList) []*bxcore.SearchList {
|
|
|
if len(resOne) > 0 && len(resTwo) > 0 {
|
|
|
for _, v := range resOne {
|
|
@@ -669,7 +667,7 @@ func DelRepeatSearchData(resOne, resTwo []*bxcore.SearchList) []*bxcore.SearchLi
|
|
|
return resOne
|
|
|
}
|
|
|
|
|
|
-//付费用户搜索优化
|
|
|
+// 付费用户搜索优化
|
|
|
func IsOptimize(cc config.Config, in *bxcore.SearchReq) bool {
|
|
|
if cc.PaySearchLimit.Switch && in.UserType != "fType" {
|
|
|
//首页----字数(<7)
|