|
@@ -106,7 +106,7 @@ func getDataExportSql(scd *SieveCondition) string {
|
|
|
starttime = fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day()-30, 0, 0, 0, 0, time.Local).Unix())
|
|
|
} else if scd.PublishTime == "thisyear" { //去年
|
|
|
starttime = fmt.Sprint(time.Date(now.Year()-1, 1, 1, 0, 0, 0, 0, time.Local).Unix())
|
|
|
- endtime = fmt.Sprint(time.Date(now.Year(), 1, 1, 0, 0, 0, 0, time.Local).Unix())
|
|
|
+ endtime = fmt.Sprint(time.Date(now.Year()-1, 12, 31, 23, 59, 59, 0, time.Local).Unix())
|
|
|
} else if strings.Contains(scd.PublishTime, "_") { //设置检索日期
|
|
|
starttime = strings.Split(scd.PublishTime, "_")[0]
|
|
|
etime := strings.Split(scd.PublishTime, "_")[1]
|
|
@@ -284,7 +284,7 @@ func GetDataExportSearchCountUseId(_id string) (count int) {
|
|
|
}
|
|
|
secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Sysconfig["elasticsearch"].(string))
|
|
|
scd.Keyword[0].Keyword = secondKWS
|
|
|
-
|
|
|
+ scd.SelectType = "title"
|
|
|
qstr = getDataExportSql(scd)
|
|
|
res2 := doSearch(qstr, 0, 100-count, "")
|
|
|
|
|
@@ -366,6 +366,7 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
|
|
|
}
|
|
|
secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Sysconfig["elasticsearch"].(string))
|
|
|
scd.Keyword[0].Keyword = secondKWS
|
|
|
+ scd.SelectType = "title"
|
|
|
qstr = getDataExportSql(scd)
|
|
|
res2 := doSearch(qstr, 0, 100-count, "")
|
|
|
return delRepeatMapArr(res, res2), kws
|
|
@@ -414,6 +415,7 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
|
|
|
if searchTextSize > 3 && num < 50 {
|
|
|
secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Sysconfig["elasticsearch"].(string))
|
|
|
scd.Keyword[0].Keyword = secondKWS
|
|
|
+ scd.SelectType = "title"
|
|
|
qstr = getDataExportSql(scd)
|
|
|
res2 := doSearch(qstr, 0, 100-num, "")
|
|
|
res = *delRepeatMapArr(&res, res2)
|
|
@@ -559,10 +561,11 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
|
|
|
if emptyNum == -1 {
|
|
|
continue
|
|
|
}
|
|
|
+ // log.Println(util.ObjToString(v["title"]), "----", kws[0].Keyword)
|
|
|
if len(kws) > 0 && kws[0].Keyword != "" {
|
|
|
var kwsFlag = true
|
|
|
for _, vk := range kws {
|
|
|
- if strings.Contains(util.ObjToString(v["title"]), vk.Keyword) {
|
|
|
+ if strings.Contains(util.ObjToString(v["title"]), strings.Replace(vk.Keyword, "+", "", -1)) {
|
|
|
kwsFlag = false
|
|
|
continue
|
|
|
}
|
|
@@ -610,11 +613,11 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
|
|
|
log.Println("没关键词的空字段数量", Nokeys)
|
|
|
//选取结果
|
|
|
for _, v := range Nokeys {
|
|
|
- if len(AllMap[v]) >= resultNum {
|
|
|
+ if len(NoKwsMap[v]) >= resultNum {
|
|
|
return append(res, NoKwsMap[v][:resultNum]...)
|
|
|
} else {
|
|
|
resultNum = resultNum - len(NoKwsMap[v])
|
|
|
- tmp := append(res, NoKwsMap[v][:len(AllMap[v])]...)
|
|
|
+ tmp := append(res, NoKwsMap[v][:len(NoKwsMap[v])]...)
|
|
|
res = tmp
|
|
|
}
|
|
|
}
|