|
@@ -31,6 +31,13 @@ const (
|
|
|
|
|
|
//GetWxsearchlistData 移动端招标信息搜索
|
|
|
func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel string, pageNum, pageSize int, selectTypeArr []string, field string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
|
|
|
+ var hightlightContent bool = false //是否高亮正文
|
|
|
+ for _, v := range selectTypeArr {
|
|
|
+ if v == "detail" {
|
|
|
+ hightlightContent = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
b_word, a_word, s_word = jy.InterceptSearchKW(keywords, selectTypeArr != nil && len(selectTypeArr) > 1, len(industry) == 0)
|
|
|
if len(b_word) == 0 {
|
|
|
return list, b_word, a_word, s_word
|
|
@@ -41,9 +48,12 @@ 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, findfields, GetBidSearchQuery(scope, publishtime, subtype, winner, buyerclass))
|
|
|
- list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, false)
|
|
|
+ if hightlightContent { //全文搜索
|
|
|
+ list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, true)
|
|
|
+ } else { //标题搜索
|
|
|
+ list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, false)
|
|
|
+ }
|
|
|
if list != nil {
|
|
|
public.BidListConvert(industry, list)
|
|
|
for _, v := range *list {
|
|
@@ -55,9 +65,14 @@ func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minpri
|
|
|
|
|
|
//GetPcBidSearchData pc端招标信息搜索
|
|
|
func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel string, start, pageSize int, isGetCount bool, selectTypeArr []string, field string) (count, totalPage int64, list *[]map[string]interface{}) {
|
|
|
- //selectType:全文搜索(all)、标题搜索(title)
|
|
|
- //全部(all)、标题(title) 正文(content) 会员: 采购单位(buyer) 中标企业(winner) 招标代理机构(agency) 附件(file)
|
|
|
var findfields string
|
|
|
+ var hightlightContent bool = false //是否高亮正文
|
|
|
+ for _, v := range selectTypeArr {
|
|
|
+ if v == "detail" {
|
|
|
+ hightlightContent = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
if selectTypeArr == nil || len(selectTypeArr) == 0 {
|
|
|
findfields = `"title"`
|
|
|
} else {
|
|
@@ -68,7 +83,12 @@ func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minpr
|
|
|
count = elastic.Count(INDEX, TYPE, qstr)
|
|
|
}
|
|
|
if !isGetCount || count > 0 || start > 0 {
|
|
|
- repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, start, pageSize, 0, false)
|
|
|
+ var repl *[]map[string]interface{}
|
|
|
+ if hightlightContent {
|
|
|
+ repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, start, pageSize, 115, true)
|
|
|
+ } else {
|
|
|
+ repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, "", bidSearch_sort, field, start, pageSize, 0, false)
|
|
|
+ }
|
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
|
public.BidListConvert(industry, repl)
|
|
|
list = repl
|