rum
rum copied to clipboard
[bug] the result is different when rum index(for tsquery) used and not used
- create table rules(id serial, keyword_rule tsquery);
- insert into rules(keyword_rule) values('( 实名举报 | 实名投诉 | 实名曝光 | 实名控诉 ) & !( 信用分 | 网上离婚 | 快速离婚 | 起诉离婚 | 考证 | 职称 | 免费咨询 | 一对一 | 提现 | 额度 | 专业 | 小说 | 离婚协议 | 追剧 | 好剧 | 短剧 | 知识 | 分享 | 保额 | 影视 | 代言 | 驾校 | 恭喜 | 高考 | 广告 | 国货 | 直播 | 二手 | 同城 | 如何 & ( 看待 | 避免 | 选择 | 导师 ) | 主播 | 说事 | 说新闻 | ( 纠纷 | 仲裁 | 考研 | 法律 ) & ( 咨询 | 专家 | 老师 ) | 汽车 & ( 服务 | 保养 | 美容 | 脚垫 ) | 转发 & 有需要 | 全集 | 房产人 | 上门 & 安装 )');
- select id from rules where to_tsvector('jiebaqry_golaxy','实名举报')@@keyword_rule; get result id:1
- create index idx_rum on rules using rum(keyword_rule);
- set enable_seqscan to FALSE ; ensure the rum index is used
- select get different resut exec sql: select id from rules where to_tsvector('jiebaqry_golaxy','实名举报')@@keyword_rule; get null.
result: the result is different when rum index(for tsquery) used and not used
the tsquery rule can be simple like this: insert into rules(keyword_rule) values('( 实名举报 | 实名投诉 | 实名曝光 | 实名控诉 ) & !( 信用分 | (转发 & 有 需要))');
when rum index is used ,no result get for the sql: select id from rules where to_tsvector('jiebaqry_golaxy','实名举报')@@keyword_rule;
simple the rule again: insert into rules (keyword_rule) values('实名举报 & !(转发&有需要)');
if keyword_rule like this , no result can get for the sql also
may be the problem is when ! and & used together
That's right, thanks for the report.
The error appears precisely in the combination of the specified operations, for example 'cat & !(rat & fat)' or by changing the order of the terms '!(rat & fat) & cat'.
It is not certain whether the root of the problem is RUM or tsquery, but we will try to figure it out.