# 需要帮助理解 discourse 搜索的工作原理

**URL:** https://meta.discourse.org/t/need-help-with-understanding-how-discourse-search-works/173342
**Category:** Support
**Created:** [2020年十二月15日 05:01 UTC](https://meta.discourse.org/t/need-help-with-understanding-how-discourse-search-works/173342 "2020-12-15T05:01:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ranjan](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Ranjan](https://meta.discourse.org/u/Ranjan)
#### Post date: [2020年十二月15日 05:01 UTC](https://meta.discourse.org/t/need-help-with-understanding-how-discourse-search-works/173342/1 "2020-12-15T05:01:56Z")

</div>

大家好，

想了解一些关于内容在搜索中如何获得优先级的信息。

通常的理解是，博客文章会通过多个与帖子相关的关键词和标签被搜索到。

例如：  
关键词可以出现在：  
**帖子的问题、主题标题、答案中的关键词、问题的分类标签等。**

如果我的理解不完整，请指正。

由于我们的社区使用的是 Discourse 平台，Discourse 是如何实现搜索功能的？  
Discourse 是否有不同的标签？这些标签是否与 Google 用于抓取信息的标签不同？

哪些标签（帖子的问题、主题标题、答案中的关键词、问题的分类标签）能为我们的社区帖子带来最佳的搜索结果？

请分享你们的看法。

谢谢。

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2020年十二月16日 00:32 UTC](https://meta.discourse.org/t/need-help-with-understanding-how-discourse-search-works/173342/2 "2020-12-16T00:32:45Z")

</div>

> [@Ranjan](#):
>
> 既然我们的社区使用的是 Discourse 平台，那么 Discourse 是如何实现搜索功能的？

您是在问 Discourse 如何让网站被 Google 搜索到吗？如果是的话，据我所知，最佳答案在此帖子中：[https://meta.discourse.org/t/beginners-guide-to-seo-with-discourse/146655/2。该主题的其他帖子中还有更多详细信息。](https://meta.discourse.org/t/beginners-guide-to-seo-with-discourse/146655/2%E3%80%82%E8%AF%A5%E4%B8%BB%E9%A2%98%E7%9A%84%E5%85%B6%E4%BB%96%E5%B8%96%E5%AD%90%E4%B8%AD%E8%BF%98%E6%9C%89%E6%9B%B4%E5%A4%9A%E8%AF%A6%E7%BB%86%E4%BF%A1%E6%81%AF%E3%80%82)

有一点需要注意，该主题提到了 Discourse Sitemap 插件。据我所知，即使没有站点地图，搜索引擎也能轻松索引 Discourse 网站。您主要需要努力的是在网站上创建人们想要阅读的高质量内容。

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [2020年十二月16日 02:23 UTC](https://meta.discourse.org/t/need-help-with-understanding-how-discourse-search-works/173342/3 "2020-12-16T02:23:31Z")

</div>

> [@simon](#):
>
> 您是在问 Discourse 如何允许网站被 Google 搜索到吗？

我认为 @Ranjan 想问的是 Discourse 应用程序内部如何实现搜索功能，而不是关于 Google 搜索。

> [@Ranjan](#):
>
> 既然我们的社区运行在 Discourse 平台上，Discourse 是如何实现搜索的？  
> 是否有不同于 Google 用于抓取信息的 Discourse 标签？
> 
> 哪些标签（帖子的问题、主题标题、答案中的关键词、问题的分类标签）能为我们社区的帖子带来最佳的搜索结果？

他似乎想了解 Discourse 如何实现其内部搜索算法。一个很好的起点是这里的 `class SearchController`：

> <https://github.com/discourse/discourse/blob/94cd5ac0b1b654ba55028c3cdead1bfb40af2991/app/controllers/search_controller.rb>

嘿，@Ranjan……您可能会惊讶地发现，Discourse 在 GitHub 上的开源代码中包含了如此丰富的信息！
