瀏覽代碼

feat:标讯搜索、数据导出扩展医疗领域化数据

fuwencai 3 年之前
父節點
當前提交
430c4ccb1e

+ 4 - 2
src/jfw/front/dataExport.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"errors"
 	"fmt"
+	"github.com/go-xweb/xweb"
 	"jfw/config"
 	"jfw/public"
 	"log"
@@ -16,8 +17,6 @@ import (
 	"strings"
 	"sync"
 	"time"
-
-	"github.com/go-xweb/xweb"
 )
 
 type DataExport struct {
@@ -389,6 +388,8 @@ func (d *DataExport) SuperSearchExport() error {
 		Notkey:       d.GetString("notkey"),                       //排除词
 		FileExists:   d.GetString("fileExists"),                   //是否有附件
 		City:         d.GetString("city"),                         //城市
+		BidField:     d.GetString("bid_field"),                    // 领域数据类型 0101- 医疗行业
+
 	}
 	selectType := strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).GetQueryItems(d.GetString("selectType"), util.Int64All(config.Sysconfig["bidSearchOldUserLimit"])), ",")
 	//数据回显
@@ -407,6 +408,7 @@ func (d *DataExport) SuperSearchExport() error {
 	d.SetSession("Echo_notkey", reqData.Notkey)
 	d.SetSession("Echo_fileExists", reqData.FileExists)
 	d.SetSession("Echo_city", reqData.City)
+	d.SetSession("Echo_bid_field", reqData.BidField) // 领域类型 0101-医疗行业
 
 	saveData := reqData.PassBidSearchExport()
 	saveData["selectType"] = selectType

+ 2 - 2
src/jfw/front/pcIndex.go

@@ -151,7 +151,7 @@ func GetNewArticle(typ int) (list []map[string]interface{}) {
 	if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
 		list = util.ObjArrToMapArr(l)
 	} else {
-		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false, false)
+		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false, false, "")
 		if lists != nil && len(*lists) > 5 {
 			*lists = (*lists)[0:6]
 			for _, v := range *lists {
@@ -442,7 +442,7 @@ func (f *PcIndex) SearchResult(at, name string) error {
 				// if datas != nil && len(*datas) > limitcount {
 				// 	*datas = (*datas)[0:limitcount]
 				// } else {
-				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", "", key_industry, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false)
+				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", "", key_industry, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false, "")
 				if datas != nil && len(*datas) > limitcount {
 					*datas = (*datas)[0:limitcount]
 				}

+ 71 - 23
src/jfw/front/supsearch.go

@@ -40,6 +40,18 @@ var PCS_time int
 var PCSLock = &sync.Mutex{}
 var FileSignBool = false
 
+const (
+	BidFieldMedical = "0101"
+)
+
+var (
+	// DomainPageType 缓存标签
+	DomainPageType = map[string]string{
+		BidFieldMedical: "medical", // 医疗领域
+
+	}
+)
+
 //
 func init() {
 	xweb.AddAction(&Pcsearch{})
@@ -93,7 +105,11 @@ func PCS_list(page_type string) interface{} {
 	  if PCS_index[_page_type] == nil {
 	  	PCS_index[_page_type] = Newbids(page_type)[0]
 	  }*/
-	return Newbids(page_type)[0]
+	if len(Newbids(page_type)) > 0 {
+		return Newbids(page_type)[0]
+	} else {
+		return nil
+	}
 }
 
 //
@@ -126,7 +142,7 @@ func (p *Pcsearch) ProposedProject() error {
 	var count int64
 	if len(s_word) > 0 {
 		status = 2
-		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, "", publishtime, subtype, "", "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false)
+		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, "", publishtime, subtype, "", "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false, "")
 		listSize := 0
 		if list != nil {
 			listSize = len(*list)
@@ -216,8 +232,11 @@ func (p *Pcsearch) Getstatus() error {
 func (p *Pcsearch) GetNewBids() error {
 	pagenum, _ := p.GetInteger("pageNumber")
 	pageType := p.GetString("pageType")
-
-	list := util.ObjArrToMapArr(Newbids(pageType)[pagenum-1].([]interface{}))
+	rs := Newbids(pageType)
+	var list []map[string]interface{}
+	if len(rs) >= pagenum {
+		list = util.ObjArrToMapArr(rs[pagenum-1].([]interface{}))
+	}
 	if pageType == "" { //最新招标信息仅第一页条展示表格多字段
 		for k, v := range list {
 			if pagenum == 1 && k < 20 {
@@ -251,6 +270,7 @@ func (p *Pcsearch) GetNewBids() error {
 func (p *Pcsearch) PcSearchIndex() error {
 	defer util.Catch()
 	p.T["logid"] = config.Seoconfig["jysslby"].(string)
+	bidField := p.GetString("bid_field") // 领域类型  医疗-0101
 	keywords := p.GetString("keywords")
 	industry := strings.TrimSpace(p.GetString("industry")) //选中的行业
 	area := p.GetString("area")                            //地区
@@ -298,6 +318,8 @@ func (p *Pcsearch) PcSearchIndex() error {
 		notkey = util.ObjToString(p.GetSession("Echo_notkey"))
 		fileExists = util.ObjToString(p.GetSession("Echo_fileExists"))
 		city = util.ObjToString(p.GetSession("Echo_city"))
+		bidField = util.ObjToString(p.GetSession("Echo_bid_field")) // 领域化数据 0101-医疗行业
+
 		_, _, queryItems, _, _ = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), 0)
 	}
 
@@ -313,10 +335,17 @@ func (p *Pcsearch) PcSearchIndex() error {
 	if len(s_word) > 0 || len(industry) > 0 {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
 		status = 2
-		secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser, searchTypeSwitch)
+		secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser, searchTypeSwitch, bidField)
 	} else {
 		p.DisableHttpCache()
-		p.T["list"] = PCS_list("") //Newbids("")[0]
+		pageType := ""
+		// 如果是领域化数据
+		if bidField != "" {
+			if domainPageType, ok := DomainPageType[bidField]; ok {
+				pageType = domainPageType
+			}
+		}
+		p.T["list"] = PCS_list(pageType) //Newbids("")[0]
 		count, totalPage = 500, 10
 	}
 	if status == 2 {
@@ -347,6 +376,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 		p.T["notkey"] = notkey
 		p.T["fileExists"] = fileExists
 		p.T["city"] = city
+		p.T["bid_field"] = bidField
 		p.SetSession("paramkey", b_word)
 		switch publishtime {
 		case "lately-7":
@@ -391,12 +421,18 @@ func Newbids(p string) []interface{} {
 	if len(pages) == 0 {
 		var list *[]map[string]interface{}
 		subtype := ""
-		if len(p) > 0 {
-			subtype = "拟建"
+		bidField := ""
+		// 判断是不是医疗行业
+		if p == "medical" {
+			bidField = "medical"
+		} else {
+			if len(p) > 0 {
+				subtype = "拟建"
+			}
 		}
 		//查询置顶信息
 		var ss []map[string]interface{}
-		ls := top500(subtype)
+		ls := top500(subtype, bidField)
 		if ls != nil && len(*ls) > 0 {
 			ss = append(ss, *ls...)
 		}
@@ -418,23 +454,27 @@ func Newbids(p string) []interface{} {
 				}
 			}
 			for i := 0; i < 10; i++ {
-				_, list = getLastNewsData("", "", "", "", subtype, "", "", "", "", "", "", "", "Y", intns[i], true, false, "")
-				ss = append(ss, *list...)
-				// pages = append(pages, list)
+				_, list = getLastNewsData("", "", "", "", subtype, "", "", "", "", "", "", "", "Y", intns[i], true, false, "", bidField)
+				if list != nil && len(*list) > 0 {
+					ss = append(ss, *list...)
+					// pages = append(pages, list)
+				}
 			}
 		}
 		data := duplicateRemoval(ss)
-		for i := 0; i < 10; i++ {
-			sta := i * 50
-			end := i*50 + 50
-			if end > len(data) {
-				pages = append(pages, data[end:])
-				break
+		if len(data) > 0 {
+			for i := 0; i < 10; i++ {
+				sta := i * 50
+				end := i*50 + 50
+				if end > len(data) {
+					pages = append(pages, data[end:])
+					break
+				}
+				pages = append(pages, data[sta:end])
 			}
-			pages = append(pages, data[sta:end])
+			redis.Put("newother", "index_list"+p, pages, 60*60*24)
+			pages, _ = redis.Get("newother", "index_list"+p).([]interface{})
 		}
-		redis.Put("newother", "index_list"+p, pages, 60*60*24)
-		pages, _ = redis.Get("newother", "index_list"+p).([]interface{})
 	}
 	return pages
 }
@@ -476,8 +516,16 @@ func duplicateRemoval(ss []map[string]interface{}) []map[string]interface{} {
 	return data
 }
 
-func top500(industry string) (list *[]map[string]interface{}) {
-	qstr := `{"query": {"bool": {"should": [{"term": {"dataweight": 1}}]}}}`
+func top500(industry string, bidField string) (list *[]map[string]interface{}) {
+	qstr := ""
+	if bidField != "" {
+		// 如果是领域化数据
+		q := `{"query": {"bool": {"should": [{"term": {"dataweight": 1}}], "must": [
+        {"term": {"bid_field": "%s"}}]}}}`
+		qstr = fmt.Sprintf(q, bidField)
+	} else {
+		qstr = `{"query": {"bool": {"should": [{"term": {"dataweight": 1}}]}}}`
+	}
 	repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, `"title"`, `{"publishtime":-1}`, bidSearch_field, 0, 500, 115, false)
 	if repl != nil && *repl != nil && len(*repl) > 0 {
 		public.BidListConvert(industry, repl)

+ 14 - 7
src/jfw/front/swordfish.go

@@ -34,7 +34,7 @@ import (
 
 var (
 	bidSearch_field_1    = `"_id","title","publishtime","toptype","subtype","type","area","dataweight","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site"`
-	bidSearch_field      = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
+	bidSearch_field      = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo","purchasing","s_winner"`
 	bidSearch_sort       = `{"dataweight":-1,"publishtime":-1}`
 	bidSearch_field_file = `,"filetext","isValidFile"`
 )
@@ -75,6 +75,7 @@ func (m *Front) Searchinfolist(p string) error {
 
 //ajax分页请求
 func (m *Front) PcAjaxReq() {
+	bidField := m.GetString("bid_field") // 领域类型 0101- 医疗
 	tabularflag := m.GetString("tabularflag")
 	userId := util.ObjToString(m.GetSession("userId"))
 	if tabularflag == "Y" && userId == "" {
@@ -86,7 +87,14 @@ func (m *Front) PcAjaxReq() {
 	if reqType == "lastBids" {
 		//ls := elastic.GetPage(INDEX, TYPE, "{}", bidSearch_sort, bidSearch_field_1, 0, 18)
 		//jyutil.BidListConvert("", ls)
-		ls := Newbids("")
+		// 如果是领域化数据
+		pageType := ""
+		if bidField != "" {
+			if domainPageType, ok := DomainPageType[bidField]; ok {
+				pageType = domainPageType
+			}
+		}
+		ls := Newbids(pageType)
 		if len(ls) >= 18 {
 			ls = ls[:18]
 		}
@@ -131,7 +139,6 @@ func (m *Front) PcAjaxReq() {
 	if tabularflag == "Y" {
 		field = bidSearch_field
 	}
-
 	searchLimit := public.IsSearchLimit(queryItems)
 
 	b_word, a_word, s_word := jy.InterceptSearchKW(m.GetString("searchvalue"), searchLimit, len(industry) == 0)
@@ -154,7 +161,7 @@ func (m *Front) PcAjaxReq() {
 			}
 		}
 		if isLimit == 1 {
-			second, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser, searchTypeSwitch)
+			second, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser, searchTypeSwitch, bidField)
 		}
 	}
 	_secondList, _totalPage, _ := bidsearch.LisetData(1, currentPage, list, secondFlag, config.Seoconfig, isPayedUser) //只有前20条
@@ -176,10 +183,10 @@ func (m *Front) PcAjaxReq() {
 	})
 }
 
-func getLastNewsData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, tabularflag string, start int, isGetCount bool, highlight bool, notkey string) (count int64, list *[]map[string]interface{}) {
+func getLastNewsData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, tabularflag string, start int, isGetCount bool, highlight bool, notkey string, bidField string) (count int64, list *[]map[string]interface{}) {
 	//最新招标信息
 	findfields := `"title"`
-	qstr := bidsearch.GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, bidsearch.GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey, false)
+	qstr := bidsearch.GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, bidsearch.GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey, false, bidField)
 	if isGetCount && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
@@ -389,7 +396,7 @@ func (m *Front) WxsearchlistPaging() {
 			}
 			if isLimit == 1 {
 				searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-				secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("wx", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser, searchTypeSwitch)
+				secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("wx", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser, searchTypeSwitch, "")
 			}
 			//新增历史记录
 			arrs = bidsearch.AddHistory(history, searchvalue)

+ 14 - 9
src/jfw/modules/common/src/qfw/util/bidsearch/search.go

@@ -53,7 +53,7 @@ func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry,
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
-	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch)
+	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch, "")
 	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, city, publishtime, subtype, industry,
 }
 
 //GetPcBidSearchData pc端招标信息搜索
-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, searchTypeSwitch 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, searchTypeSwitch bool, bidField string) (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, city, publishtime, subtype, industry,
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
-	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch)
+	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch, bidField)
 	if isGetCount && qstr != "" && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
@@ -246,7 +246,7 @@ func DetailFileORTitle(findfields string) bool {
 func DetailTitle(findfields string) bool {
 	return strings.Contains(findfields, `"detail"`) && strings.Contains(findfields, `"title"`)
 }
-func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey string, searchTypeSwitch bool) (qstr string) {
+func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey string, searchTypeSwitch bool, bidField string) (qstr string) {
 	multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s]}}`
 	query := `{"query":{"bool":{"must":[%s],"must_not":[%s]}}}`
 	//query := `{"query": {"function_score": {"query": {"bool": {"must": [%s],"must_not": [%s]}},"field_value_factor": {"field": "dataweight","modifier": "ln1p","missing": 0}}}}`
@@ -255,6 +255,7 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 	query_bool_must := `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
 	query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
+	query_bool_must_term_domain := `{"bool": {"must": [{ "term": {"bid_field": "%s"" }}]}}` // 领域化数据类型
 	gte := `"gte": %s`
 	lte := `"lte": %s`
 	musts, must_not := []string{}, []string{}
@@ -365,6 +366,10 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 			musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
 		}
 	}
+	// 如果是领域化数据则需要加标签
+	if bidField != "" {
+		musts = append(musts, fmt.Sprintf(query_bool_must_term_domain, bidField))
+	}
 	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
 	log.Println(qstr)
 	return
@@ -403,12 +408,12 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 }
 
 //所有的再次分词查询 只查标题
-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{}, field string, searchTypeSwitch bool) (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{}, field string, searchTypeSwitch bool, bidField string) (string, string, string, string, *[]map[string]interface{}) {
 	var pcAjaxFlag string
 	var secRel *[]map[string]interface{} = list
 	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, city, publishtime, subtype, "", buyerclass), notkey, searchTypeSwitch)
+		qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey, searchTypeSwitch, bidField)
 		secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, 0, 2*SearchPageSize_PC, 0, false)
 		if secRel != nil && len(*secRel) > 0 {
 			public.BidListConvert(industry, secRel)
@@ -523,7 +528,7 @@ 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, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser, searchTypeSwitch 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, searchTypeSwitch bool, bidField string) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
 	//包含标题才能进行二次搜索
 	var secondSearch = strings.Contains(strings.Join(queryItems, ","), "title")
 	var searchvalue = s_word
@@ -534,12 +539,12 @@ func SearchData(platform string, request *http.Request, currentPage int, userId,
 			count = int64(len(*list))
 		}
 	} else {
-		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, searchTypeSwitch)
+		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, searchTypeSwitch, bidField)
 	}
 
 	if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == number && secondSearch {
 		var paramList = list
-		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, field, searchTypeSwitch)
+		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, field, searchTypeSwitch, bidField)
 	}
 
 	listSize := 0

+ 9 - 0
src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go

@@ -50,6 +50,7 @@ type SieveCondition struct {
 	Comeinfrom       string    `json:"comeinfrom"`       //查询来源
 	FileExists       string    `json:"fileExists"`       //是否有附件
 	SearchTypeSwitch bool      `json:"searchTypeSwitch"` //是否开启 正文 标题同时搜索只搜正文的开关
+	BidField         string    `json:"bid_field"`        // 领域化数据 0101-医疗行业
 }
 
 const (
@@ -99,6 +100,7 @@ func getDataExportSql(scd *SieveCondition) string {
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
 	query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
+	query_bool_must_term_bidField := `{"bool": {"must": [{ "term": {"bid_field": "%s"" }}]}}` // 领域化数据类型
 	gte := `"gte": %s`
 	lte := `"lte": %s`
 
@@ -367,6 +369,12 @@ func getDataExportSql(scd *SieveCondition) string {
 			musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
 		}
 	}
+	// 如果是领域化数据则需要加标签
+	if scd.BidField != "" {
+
+		musts = append(musts, fmt.Sprintf(query_bool_must_term_bidField, scd.BidField))
+
+	}
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
 	return qstr
 }
@@ -402,6 +410,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 		SelectIds:        getStringArrFromDbResult((*query)["selectIds"]),
 		FileExists:       qutil.ObjToString((*query)["fileExists"]),
 		SearchTypeSwitch: searchTypeSwitch,
+		BidField:         qutil.ObjToString((*query)["bid_field"]), // 领域化数据
 	}
 }
 

+ 2 - 0
src/jfw/public/dataexport.go

@@ -110,6 +110,7 @@ type BidSearchExport struct {
 	Notkey       string //排除词
 	FileExists   string //是否有附件
 	City         string //城市
+	BidField     string // 领域化数据: 0101 医疗
 }
 
 func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interface{}) {
@@ -186,6 +187,7 @@ func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interf
 		"hasWinnertel": this.Haswinnertel,
 		"fileExists":   this.FileExists,
 		"comeintime":   now.Unix(),
+		"bid_field":    this.BidField,
 	}
 	//选择信息id
 	if this.SelectIds != "" {