164 Star 224 Fork 1.2K

openGauss / docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
处理查询.md 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
liyang 提交于 2020-05-29 19:27 . Upload openGauss information

处理查询

openGauss提供了函数和操作符用来操作tsquery类型的查询。

  • tsquery && tsquery

    返回两个给定查询tsquery的与结果。

  • tsquery || tsquery

    返回两个给定查询tsquery的或结果。

  • !! tsquery

    返回给定查询tsquery的非结果。

  • numnode(query tsquery) returns integer

    返回tsquery中的节点数目(词素加操作符),这个函数在检查查询是否有效(返回值大于0),或者只包含停用词(返回值等于0)时,是有用的。例如:

    postgres=# SELECT numnode(plainto_tsquery('the any'));
    NOTICE:  text-search query contains only stop words or doesn't contain lexemes, ignored
    CONTEXT:  referenced column: numnode
     numnode 
    ---------
           0
    
    postgres=# SELECT numnode('foo & bar'::tsquery);
     numnode
    ---------
           3
  • querytree(query tsquery) returns text

    返回可用于索引搜索的tsquery部分,该函数对于检测非索引查询是有用的(例如只包含停用词或否定项)。例如:

    postgres=# SELECT querytree(to_tsquery('!defined'));
     querytree 
    -----------
     T
    (1 row)
1
https://gitee.com/opengauss/docs.git
git@gitee.com:opengauss/docs.git
opengauss
docs
docs
1.1.0

搜索帮助