Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
40271811
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
40271811
编写于
8月 26, 2011
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve comments describing tsvector data structure.
上级
928311a4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
25 deletion
+27
-25
src/include/tsearch/ts_type.h
src/include/tsearch/ts_type.h
+27
-25
未找到文件。
src/include/tsearch/ts_type.h
浏览文件 @
40271811
...
...
@@ -18,6 +18,23 @@
/*
* TSVector type.
*
* Structure of tsvector datatype:
* 1) standard varlena header
* 2) int4 size - number of lexemes (WordEntry array entries)
* 3) Array of WordEntry - one per lexeme; must be sorted according to
* tsCompareString() (ie, memcmp of lexeme strings).
* WordEntry->pos gives the number of bytes from end of WordEntry
* array to start of lexeme's string, which is of length len.
* 4) Per-lexeme data storage:
* lexeme string (not null-terminated)
* if haspos is true:
* padding byte if necessary to make the position data 2-byte aligned
* uint16 number of positions that follow
* WordEntryPos[] positions
*
* The positions for each lexeme must be sorted.
*
* Note, tsvectorsend/recv believe that sizeof(WordEntry) == 4
*/
...
...
@@ -46,7 +63,7 @@ typedef uint16 WordEntryPos;
typedef
struct
{
uint16
npos
;
WordEntryPos
pos
[
1
];
/* var length */
WordEntryPos
pos
[
1
];
/* var
iable
length */
}
WordEntryPosVector
;
...
...
@@ -60,40 +77,25 @@ typedef struct
#define MAXNUMPOS (256)
#define LIMITPOS(x) ( ( (x) >= MAXENTRYPOS ) ? (MAXENTRYPOS-1) : (x) )
/*
* Structure of tsvector datatype:
* 1) standard varlena header
* 2) int4 size - number of lexemes or WordEntry array, which is the same
* 3) Array of WordEntry - sorted array, comparison based on word's length
* and strncmp(). WordEntry->pos points number of
* bytes from end of WordEntry array to start of
* corresponding lexeme.
* 4) Lexeme's storage:
* lexeme (without null-terminator)
* if haspos is true:
* padding byte if necessary to make the number of positions 2-byte aligned
* uint16 number of positions that follow.
* uint16[] positions
*
* The positions must be sorted.
*/
/* This struct represents a complete tsvector datum */
typedef
struct
{
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int32
size
;
WordEntry
entries
[
1
];
/* var
size
*/
/* lexemes follow */
WordEntry
entries
[
1
];
/* var
iable length
*/
/* lexemes follow
the entries[] array
*/
}
TSVectorData
;
typedef
TSVectorData
*
TSVector
;
#define DATAHDRSIZE (offsetof(TSVectorData, entries))
#define CALCDATASIZE(x, lenstr) (DATAHDRSIZE + (x) * sizeof(WordEntry) + (lenstr) )
#define CALCDATASIZE(nentries, lenstr) (DATAHDRSIZE + (nentries) * sizeof(WordEntry) + (lenstr) )
/* pointer to start of a tsvector's WordEntry array */
#define ARRPTR(x) ( (x)->entries )
/*
returns a pointer to the beginning of lexemes
*/
#define STRPTR(x) ( (char *) &(x)->entries[
x
->size] )
/*
pointer to start of a tsvector's lexeme storage
*/
#define STRPTR(x) ( (char *) &(x)->entries[
(x)
->size] )
#define _POSVECPTR(x, e) ((WordEntryPosVector *)(STRPTR(x) + SHORTALIGN((e)->pos + (e)->len)))
#define POSDATALEN(x,e) ( ( (e)->haspos ) ? (_POSVECPTR(x,e)->npos) : 0 )
...
...
@@ -231,7 +233,7 @@ typedef struct
{
int32
vl_len_
;
/* varlena header (do not touch directly!) */
int4
size
;
/* number of QueryItems */
char
data
[
1
];
char
data
[
1
];
/* data starts here */
}
TSQueryData
;
typedef
TSQueryData
*
TSQuery
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录