ts_lexize()

返回已知词典的输入词的替代词元的函数

ts_lexize() 是一个系统函数,用于返回指定词典已知词元的替代词元数组。

ts_lexize() 添加于 PostgreSQL 8.3

用法

ts_lexize ( dict regdictionary, token text ) → text[]

如果词元已知于词典但是一个停用词,则返回空数组;如果不是已知词元,则返回 NULL

ts_lexize() 主要用于测试词典。

变更历史

示例

ts_lexize() 的基本用法示例

postgres=# SELECT ts_lexize('english_stem', 'foxes');
 ts_lexize 
-----------
 {fox}
(1 row)

停用词返回空数组

postgres=# SELECT ts_lexize('english_stem', 'the');
 ts_lexize 
-----------
 {}
(1 row)

如果词元不是已知词元,则返回 NULL

postgres=# CREATE TEXT SEARCH DICTIONARY ispell (
   template = ispell,
   dictfile = ispell_sample,
   afffile  = ispell_sample
);
CREATE TEXT SEARCH DICTIONARY

postgres=# SELECT ts_lexize('ispell', 'yabadabadoo') IS NULL;
 ?column? 
----------
 t
(1 row)

分类

全文搜索, 系统函数, 测试

另请参阅

ts_parse(), ts_token_type(), ts_debug(), ts_stat()

反馈

在此处提交对“ts_lexize()”的任何评论、建议或更正 这里