Skip to content

Search

中文搜索支持 – 中文搜索​支持

¥Chinese search support – 中文搜索​支持

Insiders 为内置搜索插件添加了实验性的中文支持——鉴于中国用户数量众多,这一功能已被呼吁许久。

¥Insiders adds experimental Chinese language support for the built-in search plugin – a feature that has been requested for a long time given the large number of Chinese users.

继美国和德国之后,MkDocs 用户使用 Material 的第三大来源国是中国。长期以来,内置搜索插件无法正确分割中文字符,主要是因为缺少用于搜索分词和词干提取的lunr-languages支持。最新的 Insiders 版本为内置搜索插件添加了期待已久的中文支持,这是许多用户一直呼吁的。

¥After the United States and Germany, the third-largest country of origin of Material for MkDocs users is China. For a long time, the built-in search plugin didn't allow for proper segmentation of Chinese characters, mainly due to missing support in lunr-languages which is used for search tokenization and stemming. The latest Insiders release adds long-awaited Chinese language support for the built-in search plugin, something that has been requested by many users.

¥Excluding content from search

最新的 Insiders 版本带来了三种新的简单方法,可以从搜索索引中排除文档的专用部分,从而实现更细粒度的控制。

¥The latest Insiders release brings three new simple ways to exclude dedicated parts of a document from the search index, allowing for more fine-grained control.

两周前,Material for MkDocs Insiders 发布了一款全新的搜索插件,不仅大幅提升了易用性,还优化了搜索索引的速度和大小。有趣的是,正如上一篇博客文章中所讨论的,我们只是触及了现有功能的冰山一角。此版本带来了一些实用功能,提升了写作体验,允许更精细地控制 Markdown 文件中哪些页面、章节和区块应该被内置搜索功能索引。

¥Two weeks ago, Material for MkDocs Insiders shipped a brand new search plugin, yielding massive improvements in usability, but also in speed and size of the search index. Interestingly, as discussed in the previous blog article, we only scratched the surface of what's now possible. This release brings some useful features that enhance the writing experience, allowing for more fine-grained control of what pages, sections and blocks of a Markdown file should be indexed by the built-in search functionality.

搜索:更好、更快、更小

¥Search: better, faster, smaller

这是我们如何彻底重建客户端搜索的故事,在提供更好的用户体验的同时,使其变得更快、更小。

¥This is the story of how we managed to completely rebuild client-side search, delivering a significantly better user experience while making it faster and smaller at the same time.

Material for MkDocs 的搜索功能是迄今为止其最优秀、最受欢迎的资产之一:多语言离线功能,以及最重要的:全客户端。它提供了一种解决方案,使您的文档用户能够立即找到他们正在搜索的内容,而无需管理额外的服务器。然而,即使已经进行了多次迭代,仍有一些改进空间,因此我们从头开始重建了搜索插件和集成。本文将揭示新搜索的内部原理、它为何比以前的版本更强大,以及即将推出的功能。

¥The search of Material for MkDocs is by far one of its best and most-loved assets: multilingual, offline-capable, and most importantly: all client-side. It provides a solution to empower the users of your documentation to find what they're searching for instantly without the headache of managing additional servers. However, even though several iterations have been made, there's still some room for improvement, which is why we rebuilt the search plugin and integration from the ground up. This article shines some light on the internals of the new search, why it's much more powerful than the previous version, and what's about to come.