模块:Db:修订间差异
MJ Hamster(留言 | 贡献) 小无编辑摘要 |
MJ Hamster(留言 | 贡献) 小无编辑摘要 |
||
| 第328行: | 第328行: | ||
-- ** 预处理 conditionValue ** | -- ** 预处理 conditionValue ** | ||
if type(conditionValue) == 'string' then | if type(conditionValue) == 'string' then | ||
local trimmedValue = mw.text.trim(conditionValue) | local trimmedValue = mw.text.trim(conditionValue) | ||
local lowerValue = string.lower(trimmedValue) | local lowerValue = string.lower(trimmedValue) | ||
| 第374行: | 第372行: | ||
local match = false | local match = false | ||
-- | -- 1. 数字和布尔值的精确匹配 | ||
if currentValue == conditionValue then | if currentValue == conditionValue then | ||
match = true | match = true | ||
-- | |||
-- 2. 字符串匹配 | |||
elseif type(currentValue) == 'string' and type(conditionValue) == 'string' then | elseif type(currentValue) == 'string' and type(conditionValue) == 'string' then | ||
if isPackFilter | -- 2a. Pack 字段: 缩写解析后的精确匹配 (Case-insensitive Exact Match) | ||
-- | if isPackFilter then | ||
local targetValue = resolvedConditionValue -- 这会是完整的包名或原始输入 | |||
if string.upper(currentValue) == string.upper(targetValue) then | |||
match = true | |||
end | |||
-- 模糊匹配:只要 currentValue 包含 searchString(不区分大小写) | -- 2b. 其他字符串字段: 模糊匹配 (Case-insensitive Fuzzy Match) | ||
else | |||
local searchString = conditionValue | |||
-- 模糊匹配:只要 currentValue 包含 searchString(不区分大小写) | |||
if string.find(string.upper(currentValue), string.upper(searchString), 1, true) then | |||
match = true | |||
end | |||
end | end | ||
end | end | ||