|
@@ -1187,36 +1187,21 @@ local execute = function()
|
|
log('丢弃无效节点: ' .. result.alias)
|
|
log('丢弃无效节点: ' .. result.alias)
|
|
else
|
|
else
|
|
-- log('成功解析: ' .. result.type ..' 节点, ' .. result.alias)
|
|
-- log('成功解析: ' .. result.type ..' 节点, ' .. result.alias)
|
|
- -- 统一标记 grouphashkey
|
|
|
|
- result.grouphashkey = groupHash
|
|
|
|
- -- 初始化缓存
|
|
|
|
- cache[groupHash] = cache[groupHash] or {}
|
|
|
|
- -- 初始化 hashkey 对应的节点数组
|
|
|
|
|
|
+ -- 检查重复(hashkey + alias)节点
|
|
cache[groupHash][result.hashkey] = cache[groupHash][result.hashkey] or {}
|
|
cache[groupHash][result.hashkey] = cache[groupHash][result.hashkey] or {}
|
|
-
|
|
|
|
- -- 初始化 nodeResult[index]
|
|
|
|
- nodeResult[index] = nodeResult[index] or {}
|
|
|
|
-
|
|
|
|
- -- 检查是否有完全重复(hashkey + alias)节点
|
|
|
|
- local is_duplicate = nil
|
|
|
|
- for i, r in ipairs(cache[groupHash][result.hashkey]) do
|
|
|
|
|
|
+ local is_duplicate = false
|
|
|
|
+ for _, r in ipairs(cache[groupHash][result.hashkey]) do
|
|
if r.alias == result.alias then
|
|
if r.alias == result.alias then
|
|
- is_duplicate = i
|
|
|
|
|
|
+ is_duplicate = true
|
|
break
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
-
|
|
|
|
- if is_duplicate then
|
|
|
|
- -- 已经存在完全重复节点,直接丢弃其他重复节点
|
|
|
|
- log('丢弃重复节点: ' .. result.alias)
|
|
|
|
- return
|
|
|
|
|
|
+ if not is_duplicate then
|
|
|
|
+ result.grouphashkey = groupHash
|
|
|
|
+ tinsert(nodeResult[index], result)
|
|
|
|
+ cache[groupHash][result.hashkey] = nodeResult[index][#nodeResult[index]]
|
|
else
|
|
else
|
|
- -- **直接覆盖缓存中同 hashkey 的节点**
|
|
|
|
- cache[groupHash][result.hashkey] = {result}
|
|
|
|
- -- 将节点加入 nodeResult
|
|
|
|
- table.insert(nodeResult[index], result)
|
|
|
|
- -- 更新 hashkey 对应的节点数量
|
|
|
|
- cache_count[groupHash][result.hashkey] = #cache[groupHash][result.hashkey]
|
|
|
|
|
|
+ log('丢弃重复节点: ' .. result.alias)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|