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

自定义词典没有按长词优先 #62

Closed
jerrylaile opened this issue Jan 3, 2022 · 2 comments
Closed

自定义词典没有按长词优先 #62

jerrylaile opened this issue Jan 3, 2022 · 2 comments

Comments

@jerrylaile
Copy link

jerrylaile commented Jan 3, 2022

开发者,您好,我们在PostgreSQL中使用zhparser插件,发现没有按长词优先返回结果,代码和示例如下:

CREATE EXTENSION zhparser;
CREATE TEXT SEARCH CONFIGURATION testzhcfg ( PARSER = zhparser );
ALTER TEXT SEARCH CONFIGURATION testzhcfg ADD MAPPING FOR n,v,a,i,e,l WITH SIMPLE;

-- 往自定义分词词典里面插入新的分词
INSERT INTO pg_ts_custom_word
VALUES ( '味道不错'),
( '味道'),
('不错'),
( '不错的'),
( '卫生干净'),
( '卫生'),
( '干净'),
( '量挺大'),
('服务不错'),
('服务');

-- 使新的分词生效
SELECT zhprs_sync_dict_xdb ( );

-- 退出此连接
-- \c

-- 重新查询,可以得到新的分词结果

ALTER ROLE ALL SET zhparser.multi_short = ON;

SELECT TO_TSQUERY('testzhcfg', '服务不错的');
结果::'味道' & '不错'
问题:没有返回自定义词典: 味道不错
SELECT TO_TSQUERY('testzhcfg', '味道不错的');

结果::'味道' & '不错'
问题:没有返回自定义词典: 服务不错

自定义词后很奇怪,没有按照长词优先返回结果,请协助看看原因~

@wangjunjx8868
Copy link

同样的问题,帮顶

@zlianzhuang
Copy link
Collaborator

参考 #58

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

3 participants