|
@@ -590,7 +590,6 @@ func DealUserKey(tt *TTask) {
|
|
extractquery := sess.DB(tt.S_mgodb).C(tt.S_coll).Find(q).Select(nil).Sort("_id").Iter()
|
|
extractquery := sess.DB(tt.S_mgodb).C(tt.S_coll).Find(q).Select(nil).Sort("_id").Iter()
|
|
|
|
|
|
sum := 0
|
|
sum := 0
|
|
- realCount := 0
|
|
|
|
for tmp := make(map[string]interface{}); extractquery.Next(&tmp); sum++ {
|
|
for tmp := make(map[string]interface{}); extractquery.Next(&tmp); sum++ {
|
|
lastID = u.BsonIdToSId(tmp["_id"])
|
|
lastID = u.BsonIdToSId(tmp["_id"])
|
|
|
|
|
|
@@ -614,30 +613,37 @@ func DealUserKey(tt *TTask) {
|
|
if len(keys) > 0 {
|
|
if len(keys) > 0 {
|
|
//用户关键词
|
|
//用户关键词
|
|
update["key_list"] = strings.Join(tags, ",")
|
|
update["key_list"] = strings.Join(tags, ",")
|
|
|
|
+ update["i_appid"] = tmp["i_appid"]
|
|
update["_id"] = tmp["_id"]
|
|
update["_id"] = tmp["_id"]
|
|
}
|
|
}
|
|
|
|
|
|
lock.Lock()
|
|
lock.Lock()
|
|
- tmp["key_list"] = strings.Join(tags, ",")
|
|
|
|
SMap := NewClassificationRun(tt, tmp)
|
|
SMap := NewClassificationRun(tt, tmp)
|
|
- //fmt.Println("SMap=>", SMap)
|
|
|
|
subtype := SMap.Map["subscope_dy"]
|
|
subtype := SMap.Map["subscope_dy"]
|
|
-
|
|
|
|
- if tt.S_table != "" {
|
|
|
|
- // 存储到结果表
|
|
|
|
- if subtype != nil {
|
|
|
|
- if subs, ok := subtype.([]string); ok {
|
|
|
|
- update["subscope_dy"] = strings.Join(subs, ",")
|
|
|
|
|
|
+ // 存储到结果表
|
|
|
|
+ if subtype != nil {
|
|
|
|
+ if subs, ok := subtype.([]string); ok {
|
|
|
|
+ tops := []string{}
|
|
|
|
+ for _, v := range subs {
|
|
|
|
+ top := strings.Split(v, "_")[0]
|
|
|
|
+ tops = append(tops, top)
|
|
}
|
|
}
|
|
- saveUserPool = append(saveUserPool, update)
|
|
|
|
- realCount++
|
|
|
|
|
|
+ update["subscope_dy"] = strings.Join(subs, ",")
|
|
|
|
+ update["topscope_dy"] = strings.Join(tops, ",")
|
|
}
|
|
}
|
|
- if len(saveUserPool) > NN {
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if len(update) > 0 {
|
|
|
|
+ saveUserPool = append(saveUserPool, update)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if len(saveUserPool) > NN {
|
|
|
|
+ //存储到新表
|
|
|
|
+ if tt.S_table != "" {
|
|
tt.MgoTask.SaveBulk(tt.S_table, saveUserPool...)
|
|
tt.MgoTask.SaveBulk(tt.S_table, saveUserPool...)
|
|
saveUserPool = []map[string]interface{}{}
|
|
saveUserPool = []map[string]interface{}{}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
lock.Unlock()
|
|
lock.Unlock()
|
|
|
|
|
|
}(tmp)
|
|
}(tmp)
|
|
@@ -648,8 +654,11 @@ func DealUserKey(tt *TTask) {
|
|
wg.Wait()
|
|
wg.Wait()
|
|
|
|
|
|
if len(saveUserPool) > 0 {
|
|
if len(saveUserPool) > 0 {
|
|
- tt.MgoTask.SaveBulk(tt.S_table, saveUserPool...)
|
|
|
|
- saveUserPool = []map[string]interface{}{}
|
|
|
|
|
|
+ //存储到新表
|
|
|
|
+ if tt.S_table != "" {
|
|
|
|
+ tt.MgoTask.SaveBulk(tt.S_table, saveUserPool...)
|
|
|
|
+ saveUserPool = []map[string]interface{}{}
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if lastID > tt.LastId {
|
|
if lastID > tt.LastId {
|