Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] the result is different when rum index(for tsquery) used and not used #123

Open
miaojianxin opened this issue Apr 3, 2024 · 2 comments

Comments

@miaojianxin
Copy link

  1. create table rules(id serial, keyword_rule tsquery);
  2. insert into rules(keyword_rule) values('( 实名举报 | 实名投诉 | 实名曝光 | 实名控诉 ) & !( 信用分 | 网上离婚 | 快速离婚 | 起诉离婚 | 考证 | 职称 | 免费咨询 | 一对一 | 提现 | 额度 | 专业 | 小说 | 离婚协议 | 追剧 | 好剧 | 短剧 | 知识 | 分享 | 保额 | 影视 | 代言 | 驾校 | 恭喜 | 高考 | 广告 | 国货 | 直播 | 二手 | 同城 | 如何 & ( 看待 | 避免 | 选择 | 导师 ) | 主播 | 说事 | 说新闻 | ( 纠纷 | 仲裁 | 考研 | 法律 ) & ( 咨询 | 专家 | 老师 ) | 汽车 & ( 服务 | 保养 | 美容 | 脚垫 ) | 转发 & 有需要 | 全集 | 房产人 | 上门 & 安装 )');
  3. select id from rules where to_tsvector('jiebaqry_golaxy','实名举报')@@keyword_rule;
    get result id:1
  4. create index idx_rum on rules using rum(keyword_rule);
  5. set enable_seqscan to FALSE ;
    ensure the rum index is used
  6. 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

@miaojianxin
Copy link
Author

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;

@miaojianxin
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant