|
@@ -24,12 +24,12 @@ import (
|
|
|
var (
|
|
|
lock, lockrule, lockclear sync.RWMutex
|
|
|
|
|
|
- cut = ju.NewCut() //获取正文并清理
|
|
|
- ExtLogs map[*TaskInfo][]map[string]interface{} //抽取日志
|
|
|
- TaskList map[string]*ExtractTask //任务列表
|
|
|
- ClearTaskList map[string]*ClearTask //清理任务列表
|
|
|
- saveLimit = 200 //抽取日志批量保存
|
|
|
- PageSize = 5000 //查询分页
|
|
|
+ cut = ju.NewCut() //获取正文并清理
|
|
|
+ ExtLogs map[*TaskInfo][]map[string]interface{} //抽取日志
|
|
|
+ TaskList map[string]*ExtractTask //任务列表
|
|
|
+ ClearTaskList map[string]*ClearTask //清理任务列表
|
|
|
+ saveLimit = 200 //抽取日志批量保存
|
|
|
+ PageSize = 5000 //查询分页
|
|
|
Fields = `{"title":1,"summary":1,"detail":1,"contenthtml":1,"site":1,"spidercode":1,"toptype":1,"subtype":1,"area":1,"city":1,"comeintime":1,"publishtime":1,"sensitive":1,"projectinfo":1,"jsondata":1}`
|
|
|
Fields2 = `{"budget":1,"bidamount":1,"title":1,"projectname":1,"winner":1}`
|
|
|
)
|
|
@@ -660,7 +660,7 @@ func ExtRegCore(extfrom string, doc map[string]interface{}, j *ju.Job, in *RegLu
|
|
|
if tmp["blocktag"] != nil {
|
|
|
btag := make(map[string]string)
|
|
|
for k := range tmp["blocktag"].(map[string]bool) {
|
|
|
- if TagConfigDesc[k] != ""{
|
|
|
+ if TagConfigDesc[k] != "" {
|
|
|
btag[k] = TagConfigDesc[k]
|
|
|
}
|
|
|
}
|
|
@@ -718,6 +718,9 @@ func getKvByLuaFields(extfrom string, j *ju.Job, in *RegLuaInfo, t map[string][]
|
|
|
}
|
|
|
}
|
|
|
for fieldname, field := range in.LFields {
|
|
|
+ if field != in.Field {
|
|
|
+ continue
|
|
|
+ }
|
|
|
for _, bl := range blocks {
|
|
|
tp := ""
|
|
|
for k, v := range []*ju.JobKv{bl.ColonKV, bl.SpaceKV, bl.TableKV} {
|
|
@@ -916,6 +919,9 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
|
|
|
text = in.RegPreBac.Reg.ReplaceAllString(text, in.RegPreBac.Replace)
|
|
|
}
|
|
|
j.Result[in.Field][k].Value = text
|
|
|
+ if text == qu.ObjToString(v.Value) { //值未发生改变,不存日志
|
|
|
+ continue
|
|
|
+ }
|
|
|
exts = append(exts, map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
@@ -943,6 +949,9 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
|
|
|
text = in.RegPreBac.Reg.ReplaceAllString(text, in.RegPreBac.Replace)
|
|
|
}
|
|
|
j.Result[key][k].Value = text
|
|
|
+ if text == qu.ObjToString(v.Value) { //值未发生改变,不存日志
|
|
|
+ continue
|
|
|
+ }
|
|
|
exts = append(exts, map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
@@ -1425,7 +1434,7 @@ func (e *ExtractTask) QualityAudit(resulttmp map[string]interface{}) {
|
|
|
func (e *ExtractTask) RedisMatch(field, fv string, val map[string]interface{}) {
|
|
|
defer qu.Catch()
|
|
|
i := redis.GetInt(field, field+"_"+fv) //查找redis
|
|
|
- if i == 0 { //reids未找到,执行规则匹配
|
|
|
+ if i == 0 { //reids未找到,执行规则匹配
|
|
|
val[field+"_isredis"] = false
|
|
|
e.RuleMatch(field, fv, val) //规则匹配
|
|
|
} else { //redis找到,打标识存库
|