fst query
This commit is contained in:
parent
65d72a48b4
commit
33bd962894
|
@ -97,6 +97,7 @@ class FstReadMemory {
|
||||||
std::string key(ch, sz);
|
std::string key(ch, sz);
|
||||||
printf("key: %s, val: %" PRIu64 "\n", key.c_str(), (uint64_t)(rt->out.out));
|
printf("key: %s, val: %" PRIu64 "\n", key.c_str(), (uint64_t)(rt->out.out));
|
||||||
swsResultDestroy(rt);
|
swsResultDestroy(rt);
|
||||||
|
result.push_back(rt->out.out);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < result.size(); i++) {
|
for (size_t i = 0; i < result.size(); i++) {
|
||||||
}
|
}
|
||||||
|
@ -280,6 +281,11 @@ void checkFstCheckIteratorPrefix() {
|
||||||
fw->Put("Hello world", 1);
|
fw->Put("Hello world", 1);
|
||||||
fw->Put("Hello worle", 2);
|
fw->Put("Hello worle", 2);
|
||||||
fw->Put("hello worlf", 4);
|
fw->Put("hello worlf", 4);
|
||||||
|
fw->Put("ja", 4);
|
||||||
|
fw->Put("jb", 4);
|
||||||
|
fw->Put("jc", 4);
|
||||||
|
fw->Put("jddddddddd", 4);
|
||||||
|
fw->Put("jefffffff", 4);
|
||||||
delete fw;
|
delete fw;
|
||||||
|
|
||||||
FstReadMemory* m = new FstReadMemory(1024 * 64);
|
FstReadMemory* m = new FstReadMemory(1024 * 64);
|
||||||
|
@ -288,19 +294,32 @@ void checkFstCheckIteratorPrefix() {
|
||||||
delete m;
|
delete m;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
// prefix search
|
||||||
|
std::vector<uint64_t> result;
|
||||||
|
|
||||||
// prefix search
|
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_PREFIX);
|
||||||
std::vector<uint64_t> result;
|
m->Search(ctx, result);
|
||||||
|
assert(result.size() == 1);
|
||||||
AutomationCtx* ctx = automCtxCreate((void*)"he", AUTOMATION_PREFIX);
|
taosMemoryFree(ctx);
|
||||||
m->Search(ctx, result);
|
|
||||||
std::cout << "size: " << result.size() << std::endl;
|
|
||||||
// assert(result.size() == count);
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
// assert(result[i] == i); // check result
|
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
// prefix search
|
||||||
|
std::vector<uint64_t> result;
|
||||||
|
|
||||||
taosMemoryFree(ctx);
|
AutomationCtx* ctx = automCtxCreate((void*)"Hello", AUTOMATION_PREFIX);
|
||||||
|
m->Search(ctx, result);
|
||||||
|
assert(result.size() == 2);
|
||||||
|
taosMemoryFree(ctx);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<uint64_t> result;
|
||||||
|
|
||||||
|
AutomationCtx* ctx = automCtxCreate((void*)"jddd", AUTOMATION_PREFIX);
|
||||||
|
m->Search(ctx, result);
|
||||||
|
assert(result.size() == 1);
|
||||||
|
taosMemoryFree(ctx);
|
||||||
|
}
|
||||||
delete m;
|
delete m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue