|
@@ -105,6 +105,9 @@ func ScoreFields(j *ju.Job, ftag map[string][]*Tag) map[string][]*ju.ExtField {
|
|
qu.Catch()
|
|
qu.Catch()
|
|
result := j.Result
|
|
result := j.Result
|
|
for field, tmps := range result {
|
|
for field, tmps := range result {
|
|
|
|
+ if field == "projectcode" {
|
|
|
|
+ tmps = projectWeightClear(tmps)
|
|
|
|
+ }
|
|
locktag.Lock()
|
|
locktag.Lock()
|
|
taglength := len(ftag[field])
|
|
taglength := len(ftag[field])
|
|
locktag.Unlock()
|
|
locktag.Unlock()
|
|
@@ -307,3 +310,26 @@ func ScoreFields(j *ju.Job, ftag map[string][]*Tag) map[string][]*ju.ExtField {
|
|
}
|
|
}
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//项目编号权重清理
|
|
|
|
+func projectWeightClear(tmps []*ju.ExtField) []*ju.ExtField {
|
|
|
|
+ newList := make([]*ju.ExtField, 0)
|
|
|
|
+ if len(tmps)<1{
|
|
|
|
+ return newList
|
|
|
|
+ }
|
|
|
|
+ tmpWeight := -999 //记录最大权重
|
|
|
|
+ tmpIndex := -999 //记录最大权重下标
|
|
|
|
+ for i, v := range tmps {
|
|
|
|
+ if v.Weight == 0 {
|
|
|
|
+ newList = append(newList, v)
|
|
|
|
+ continue
|
|
|
|
+ } else if v.Weight > tmpWeight {
|
|
|
|
+ tmpWeight = v.Weight
|
|
|
|
+ tmpIndex = i
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if tmpIndex != -999 {
|
|
|
|
+ newList = append(newList, tmps[tmpIndex])
|
|
|
|
+ }
|
|
|
|
+ return newList
|
|
|
|
+}
|