提交 f2c9f40d 编写于 作者: dengyihao's avatar dengyihao

add fuzzy search

上级 baf28ece
...@@ -193,9 +193,26 @@ void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) { ...@@ -193,9 +193,26 @@ void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) {
dfaAdd(dfa, set, inst->sv.len1); dfaAdd(dfa, set, inst->sv.len1);
dfaAdd(dfa, set, inst->sv.len2); dfaAdd(dfa, set, inst->sv.len2);
} }
return; return;
} }
bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) { bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) {
// impl run bool isMatch = false;
return true; sparSetClear(to);
for (int i = 0; i < sparSetLen(from); i++) {
uint32_t ip = sparSetGet(from, i);
Inst *inst = taosArrayGet(dfa->insts, ip);
if (inst->ty == JUMP || inst->ty == SPLIT) {
continue;
} else if (inst->ty == MATCH) {
isMatch = true;
} else if (inst->ty == RANGE) {
if (inst->rv.start <= byte && byte <= inst->rv.end) {
dfaAdd(dfa, to, ip + 1);
}
}
}
return isMatch;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册