GBase 8c
其他
文章
GBase 8c全文检索-文本匹配
发表于2023-12-11 09:37:1029次浏览1个评论
GBase 8c的全文搜索基于匹配操作符@@,它在一个tsvector(文档)匹配一个tsquery(查询)时返回true。例如:
gbase=# SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector @@ 'cat & rat'::tsquery;
?column?
----------
t
(1 row)
gbase=# SELECT 'fat & cow'::tsquery @@ 'a fat cat sat on a mat and ate a fat rat'::tsvector;
?column?
----------
f
(1 row)
tsquery可以包含搜索术语,并且可以使用 AND 、OR、NOT 以及 FOLLOWED BY 操作符结合多个术语。函数to_tsquery、plainto_tsquery以及phraseto_tsquery可用于将用户书写的文本转换为正确的tsquery。
热门帖子
- 12025-12-01浏览数:182763
- 22023-05-09浏览数:25057
- 42023-09-25浏览数:18525
- 52020-05-11浏览数:17529