什么是高级?这就叫高级—openGauss(329)

31 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

解析文档

openGauss中提供了to_tsvector函数把文档处理成tsvector数据类型。

to_tsvector([ config regconfig, ] document text) returns tsvector

to_tsvector将文本文档解析为token,再将token简化到词素,并返回一个tsvector。其中tsvector中列出了词素及它们在文档中的位置。文档是根据指定的或默认的文本搜索分词器进行处理的。这里有一个简单的例子:

openGauss=# SELECT to_tsvector('english', 'a fat  cat sat on a mat - it ate a fat rats');
                  to_tsvector
-----------------------------------------------------
 'ate':9 'cat':3 'fat':2,11 'mat':7 'rat':12 'sat':4

通过以上例子可发现结果tsvector不包含词a、on或者it,rats变成rat,并且忽略标点符号-。

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/