Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2375f6c9
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2375f6c9
编写于
12月 19, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update cache search
上级
f074a4b3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
62 addition
and
13 deletion
+62
-13
include/libs/index/index.h
include/libs/index/index.h
+0
-1
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+7
-3
source/libs/index/src/index.c
source/libs/index/src/index.c
+55
-9
未找到文件。
include/libs/index/index.h
浏览文件 @
2375f6c9
...
@@ -71,7 +71,6 @@ void indexMultiTermDestroy(SIndexMultiTerm *terms);
...
@@ -71,7 +71,6 @@ void indexMultiTermDestroy(SIndexMultiTerm *terms);
SIndexOpts
*
indexOptsCreate
();
SIndexOpts
*
indexOptsCreate
();
void
indexOptsDestroy
(
SIndexOpts
*
opts
);
void
indexOptsDestroy
(
SIndexOpts
*
opts
);
/*
/*
* @param:
* @param:
* @param:
* @param:
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
2375f6c9
...
@@ -48,9 +48,13 @@ struct SIndex {
...
@@ -48,9 +48,13 @@ struct SIndex {
struct
SIndexOpts
{
struct
SIndexOpts
{
#ifdef USE_LUCENE
#ifdef USE_LUCENE
void
*
opts
;
void
*
opts
;
#endif
#endif
int32_t
numOfItermLimit
;
int8_t
mergeInterval
;
#ifdef USE_INVERTED_INDEX
int32_t
cacheSize
;
// MB
// add cache module later
#endif
};
};
struct
SIndexMultiTermQuery
{
struct
SIndexMultiTermQuery
{
...
...
source/libs/index/src/index.c
浏览文件 @
2375f6c9
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "index.h"
#include "index.h"
#include "indexInt.h"
#include "indexInt.h"
#include "index_cache.h"
#include "index_cache.h"
#include "tdef.h"
#ifdef USE_LUCENE
#ifdef USE_LUCENE
#include "lucene++/Lucene_c.h"
#include "lucene++/Lucene_c.h"
...
@@ -30,13 +31,13 @@ typedef struct SIdxColInfo {
...
@@ -30,13 +31,13 @@ typedef struct SIdxColInfo {
static
pthread_once_t
isInit
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
isInit
=
PTHREAD_ONCE_INIT
;
static
void
indexInit
();
static
void
indexInit
();
static
int
indexMergeCacheIntoTindex
(
struct
SIndex
*
sIdx
)
{
if
(
sIdx
==
NULL
)
{
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
);
return
-
1
;
static
int
indexMergeCacheIntoTindex
(
SIndex
*
sIdx
);
}
indexWarn
(
"suid %"
PRIu64
" merge cache into tindex"
,
sIdx
->
suid
);
static
void
indexInterResultsDestroy
(
SArray
*
results
);
return
0
;
static
int
indexMergeFinalResults
(
SArray
*
interResults
,
EIndexOperatorType
oType
,
SArray
*
finalResult
);
}
int
indexOpen
(
SIndexOpts
*
opts
,
const
char
*
path
,
SIndex
**
index
)
{
int
indexOpen
(
SIndexOpts
*
opts
,
const
char
*
path
,
SIndex
**
index
)
{
pthread_once
(
&
isInit
,
indexInit
);
pthread_once
(
&
isInit
,
indexInit
);
SIndex
*
sIdx
=
calloc
(
1
,
sizeof
(
SIndex
));
SIndex
*
sIdx
=
calloc
(
1
,
sizeof
(
SIndex
));
...
@@ -49,8 +50,8 @@ int indexOpen(SIndexOpts *opts, const char *path, SIndex **index) {
...
@@ -49,8 +50,8 @@ int indexOpen(SIndexOpts *opts, const char *path, SIndex **index) {
sIdx
->
cache
=
(
void
*
)
indexCacheCreate
();
sIdx
->
cache
=
(
void
*
)
indexCacheCreate
();
sIdx
->
tindex
=
NULL
;
sIdx
->
tindex
=
NULL
;
sIdx
->
colObj
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
sIdx
->
colObj
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
sIdx
->
colId
=
1
;
sIdx
->
colId
=
1
;
sIdx
->
cVersion
=
1
;
sIdx
->
cVersion
=
1
;
pthread_mutex_init
(
&
sIdx
->
mtx
,
NULL
);
pthread_mutex_init
(
&
sIdx
->
mtx
,
NULL
);
...
@@ -162,12 +163,25 @@ int indexSearch(SIndex *index, SIndexMultiTermQuery *multiQuerys, SArray *result
...
@@ -162,12 +163,25 @@ int indexSearch(SIndex *index, SIndexMultiTermQuery *multiQuerys, SArray *result
#endif
#endif
#ifdef USE_INVERTED_INDEX
#ifdef USE_INVERTED_INDEX
EIndexOperatorType
opera
=
multiQuerys
->
opera
;
// relation of querys
SArray
*
interResults
=
taosArrayInit
(
4
,
POINTER_BYTES
);
int
nQuery
=
taosArrayGetSize
(
multiQuerys
->
query
);
for
(
size_t
i
=
0
;
i
<
nQuery
;
i
++
)
{
SIndexTermQuery
*
qTerm
=
taosArrayGet
(
multiQuerys
->
query
,
i
);
SArray
*
tResult
=
NULL
;
indexTermSearch
(
index
,
qTerm
,
&
tResult
);
taosArrayPush
(
interResults
,
(
void
*
)
&
tResult
);
}
indexMergeFinalResults
(
interResults
,
opera
,
result
);
indexInterResultsDestroy
(
interResults
);
#endif
#endif
return
1
;
return
1
;
}
}
int
indexDelete
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
)
{
int
indexDelete
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
)
{
#ifdef USE_INVERTED_INDEX
#ifdef USE_INVERTED_INDEX
#endif
#endif
...
@@ -259,3 +273,35 @@ void indexMultiTermDestroy(SIndexMultiTerm *terms) {
...
@@ -259,3 +273,35 @@ void indexMultiTermDestroy(SIndexMultiTerm *terms) {
void
indexInit
()
{
void
indexInit
()
{
//do nothing
//do nothing
}
}
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
)
{
}
static
void
indexInterResultsDestroy
(
SArray
*
results
)
{
if
(
results
==
NULL
)
{
return
;
}
size_t
sz
=
taosArrayGetSize
(
results
);
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
SArray
*
p
=
taosArrayGetP
(
results
,
i
);
taosArrayDestroy
(
p
);
}
taosArrayDestroy
(
results
);
}
static
int
indexMergeFinalResults
(
SArray
*
interResults
,
EIndexOperatorType
oType
,
SArray
*
fResults
)
{
if
(
oType
==
MUST
)
{
// tag1 condition && tag2 condition
}
else
if
(
oType
==
SHOULD
)
{
// tag1 condistion || tag2 condition
}
else
if
(
oType
==
NOT
)
{
// not use currently
}
return
0
;
}
static
int
indexMergeCacheIntoTindex
(
SIndex
*
sIdx
)
{
if
(
sIdx
==
NULL
)
{
return
-
1
;
}
indexWarn
(
"suid %"
PRIu64
" merge cache into tindex"
,
sIdx
->
suid
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录