Skip Navigation

[Resolved] 用Relevanssi来对custom post type进行中文的文字搜索有点问题

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#1906013

ben

你好 Luo Yang,

我有好几个网站都用toolset和Relevanssi来完成文字搜索功能。我是根据这个页面来进行配置的 https://toolset.com/documentation/legacy-features/views-plugin/searching-texts-custom-fields-views-relevanssi/

但我搜索中文关键词的时候,有时候可以搜索到,有时候不行。我也看了一些相关的文章,说relevanssi不支持中文和日文,但是在这篇文章里面,hidden link 有一个更新提到:

Update 25.11.2020: Matthew Wang has suggested using a Chinese language segmentation tool like phpjieba. If you have the jieba() function installed on your site, you can use it for tokenizing Chinese text like this:

我想问问你对custom post type进行中文的文字搜索有没有其他更好的方法?或者上面提到的那个方案是否可行?

我这边有一个网站 hidden link

- 当用Relevanssi来搜索Post的时候,输入什么中文都是可以完美搜索到的,你可以在hidden link
- 但对于我的custom post type来说,就会出现上面提到的问题,你可以在hidden link

如果我有什么描述不清楚的,请你告诉我。

谢谢
Ben

#1906085

你好啊,

我刚刚在你的网站尝试搜索关键词“尊重”,我可以得到3页结果:
hidden link

没有看到你说的问题:
如果搜索“尊重”,没有结果

有说明遗漏的吗?还是只是缓存问题?

#1906089

ben

谢谢回复。

你搜索的那个地方是正常的,因为搜索的是wordpress默认的post type.

有问题的是搜索custom post type的时候,你可以在hidden link 页面尝试一下:如果搜索“你对工作有多尊重”,可以出来结果;如果搜索“尊重”,没有结果。

#1906107

我可以看到你说的问题了。

我建议你尝试在hidden link 页面禁用掉Relevanssi:
https://toolset.com/wp-content/uploads/2016/08/toolset-relevanssi-selecting-content-to-search.png
选择Post content and title, 参考上面的截图上,试试能不能得到正确的搜索结果。

如果确认是Relevanssi插件的问题,那你需要与Relevanssi他们的supports联系,获取最佳的解决办法

#1906113

ben

我之前选择的是“Title, body and custom fields”,但我按照你的建议选择了 Post content and title后,问题就解决了。

只是我目前不能搜索custom fields里面的东西,我也知道Relevanssi已经明确了他们的插件搜索中文是有点问题的(参考文档是 hidden link

不过现在看来,你的建议已经对我来说比较有帮助了,多谢啊。我再测试测试。

#1906229

好的,如需更多帮助,请更新此贴。