返回首页

gbase数据、南大通用产品文档:GBase8c文本检索调试函数

更新日期:2024年09月11日


ts_debug([ config regconfig, ] document text, OUT alias text, OUT description text, OUT
token text, OUT dictionaries regdictionary[], OUT dictionary regdictionary, OUT lexemes
text[])
描述:测试一个配置。
返回类型:setof record
示例:
gbase=# SELECT ts_debug('english', 'The Brightest supernovaes');
ts_debug
-----------------------------------------------------------------------------
------
(asciiword,"Word, all ASCII",The,{english_stem},english_stem,{})
(blank,"Space symbols"," ",{},,)
(asciiword,"Word, all
ASCII",Brightest,{english_stem},english_stem,{brightest})
(blank,"Space symbols"," ",{},,)
(asciiword,"Word, all
ASCII",supernovaes,{english_stem},english_stem,{supernova})
(5 rows)

ts_lexize(dict regdictionary, token text)
描述:测试一个数据字典。
返回类型:text[]
示例:
gbase=# SELECT ts_lexize('english_stem', 'stars');
ts_lexize

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
273
-----------
{star}
(1 row)

ts_parse(parser_name text, document text, OUT tokid integer, OUT token text)
描述:测试一个解析。
返回类型:setof record
示例:
gbase=# SELECT ts_parse('default', 'foo - bar');
ts_parse
-----------
(1,foo)
(12," ")
(12,"- ")
(1,bar)
(4 rows)

ts_parse(parser_oid oid, document text, OUT tokid integer, OUT token text)
描述:测试一个解析。
返回类型:setof record
示例:
gbase=# SELECT ts_parse(3722, 'foo - bar');
ts_parse
-----------
(1,foo)
(12," ")
(12,"- ")
(1,bar)
(4 rows)

ts_token_type(parser_name text, OUT tokid integer, OUT alias text, OUT description text)
描述:获取分析器定义的记号类型。
返回类型:setof record

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
274
示例:
gbase=# SELECT ts_token_type('default');
ts_token_type
--------------------------------------------------------------
(1,asciiword,"Word, all ASCII")
(2,word,"Word, all letters")
(3,numword,"Word, letters and digits")
(4,email,"Email address")
(5,url,URL)
(6,host,Host)
(7,sfloat,"Scientific notation")
(8,version,"Version number")
(9,hword_numpart,"Hyphenated word part, letters and digits")
(10,hword_part,"Hyphenated word part, all letters")
(11,hword_asciipart,"Hyphenated word part, all ASCII")
(12,blank,"Space symbols")
(13,tag,"XML tag")
(14,protocol,"Protocol head")
(15,numhword,"Hyphenated word, letters and digits")
(16,asciihword,"Hyphenated word, all ASCII")
(17,hword,"Hyphenated word, all letters")
(18,url_path,"URL path")
(19,file,"File or path name")
(20,float,"Decimal notation")
(21,int,"Signed integer")
(22,uint,"Unsigned integer")
(23,entity,"XML entity")
(23 rows)

ts_token_type(parser_oid oid, OUT tokid integer, OUT alias text, OUT description text)
描述:获取分析器定义的记号类型。
返回类型:setof record
示例:
gbase=# SELECT ts_token_type(3722);
ts_token_type
--------------------------------------------------------------
(1,asciiword,"Word, all ASCII")
(2,word,"Word, all letters")

GBase 8c SQL 参考手册
南大通用数据技术股份有限公司
275
(3,numword,"Word, letters and digits")
(4,email,"Email address")
(5,url,URL)
(6,host,Host)
(7,sfloat,"Scientific notation")
(8,version,"Version number")
(9,hword_numpart,"Hyphenated word part, letters and digits")
(10,hword_part,"Hyphenated word part, all letters")
(11,hword_asciipart,"Hyphenated word part, all ASCII")
(12,blank,"Space symbols")
(13,tag,"XML tag")
(14,protocol,"Protocol head")
(15,numhword,"Hyphenated word, letters and digits")
(16,asciihword,"Hyphenated word, all ASCII")
(17,hword,"Hyphenated word, all letters")
(18,url_path,"URL path")
(19,file,"File or path name")
(20,float,"Decimal notation")
(21,int,"Signed integer")
(22,uint,"Unsigned integer")
(23,entity,"XML entity")
(23 rows)

ts_stat(sqlquery text, [ weights text, ] OUT word text, OUT ndoc integer, OUT nentry
integer)
描述:获取tsvector 列的统计数据。
返回类型:setof record
示例:
gbase=# SELECT ts_stat('select ''hello world''::tsvector');
ts_stat
-------------
(world,1,1)
(hello,1,1)
(2 rows)

IEEE 标准。实际的范围根据硬件或操作系统的不同可能稍微小些。
GBase UP 允许在关键字DOUBLE 后面的括号内选择用位指定精度,即DOUBLE
(X)。
0 到23 的精度对应FLOAT 列的4 字节单精度,
24 到53 的精度对应DOUBLE
列的8 字节双精度。当24<=X<=53 时,FLOAT(X)与DOUBLE(X)等价。
同时GBase UP 允许使用非标准语法DOUBLE(M,D)(M 是整数位数和小数位数的
总位数,D 是小数的个数),GBase UP 保存值时进行四舍五入。

示例1:定义的列数据类型为DOUBLE。
示例中用到的表及数据:
CREATE TABLE products(productnum DOUBLE);

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 346
INSERT INTO products(productnum) VALUES(-19000.44365);

gbase> DESC products;
+------------+--------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------+------+-----+---------+-------+
| productnum | double | YES | | NULL | |
+------------+--------+------+-----+---------+-------+
1 row in set

gbase> SELECT productnum FROM products;
+--------------+
| productnum |
+--------------+
| -19000.44365 |
+--------------+
1 row in set

说明
操作符优先级在下面列出,从最高到最低。
同一行的操作符具有同样的优先级。
BINARY,COLLATE
!
-(unary minus),~(unary bit inversion)
^
*,/,DIV,%,MOD
-,+
<<,>>
&
|
=,<=>,>=,>,<=,<,<>,!=,IS,LIKE,REGEXP,IN
BETWEEN,CASE,WHEN,THEN,ELSE
NOT
&&,AND
OR,XOR
:=