# 论坛搜索结果默认显示最新帖子，而不是最早的帖子

**URL:** <https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059>\
**Category:** Marketplace\
**Created:** [2023年七月9日 23:36 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059 "2023-07-09T23:36:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![c12gene](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/c12gene/32/181974_2.png) [@c12gene](https://meta.discourse.org/u/c12gene)\
**Post date:** [2023年七月9日 23:36 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/1 "2023-07-09T23:36:16Z")

</div>

**您希望完成什么？** 需要有人为我们的论坛编码，以便搜索结果显示最新的内容而不是最旧的内容。请看我附加的图片…

例如，当我输入的单词 gold 在我们的搜索栏中时，排在最前面的结果来自 2020 年。如果结果按时间顺序从新到旧返回，将更能使我们的会员受益。

 ![iScreen Shoter - Google Chrome - 230709163405](https://global.discourse-cdn.com/meta/original/4X/6/b/b/6bb07e83c6ed6a360cc0fd17f7a4eb0e63edb180.jpeg)

**您何时需要完成？** 尽快

您能为这项任务提供多少美元预算？ $100

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2023年七月10日 00:50 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/2 "2023-07-10T00:50:18Z")

</div>

也可以通过指定 `order:latest` / `l` 或 `order:oldest` 来临时进行订购。

您也可以查看 `search prefer recent posts`，看看这是否能提供您想要的行为。

---

<div class="post-metadata">

**Author:** ![c12gene](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/c12gene/32/181974_2.png) [@c12gene](https://meta.discourse.org/u/c12gene)\
**Post date:** [2023年七月10日 01:08 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/3 "2023-07-10T01:08:03Z")

</div>

嘿 @supermathie，你能为我们实现这个功能吗？我一点编程技能都没有。这样做的目的是编写代码，这样我就不必向用户解释如何使用高级搜索功能。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2023年七月10日 01:33 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/4 "2023-07-10T01:33:47Z")

</div>

> [@supermathie](#):
>
> You might also look at `search prefer recent posts` to see if that gives you the behaviour you want.

尝试设置该网站设置。无需编码。

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2023年七月10日 01:35 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/5 "2023-07-10T01:35:28Z")

</div>

我的 JS 技能有限，而且我正忙于后端工作。🤣

话虽如此，但我怀疑如果有人愿意接手，这可能是一个非常简单的主题组件。它可以修改搜索栏，在搜索时直接添加“排序”按钮，而无需进行任何后端更改。

这样一来，您的用户在搜索时就能将所需功能放在最前面，而无需进行后端搜索更改或添加另一个站点设置。

---

<div class="post-metadata">

**Author:** ![c12gene](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/c12gene/32/181974_2.png) [@c12gene](https://meta.discourse.org/u/c12gene)\
**Post date:** [2023年七月10日 03:04 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/6 "2023-07-10T03:04:20Z")

</div>

谢谢你指出来。看起来我已经把它打开了。它似乎不会影响搜索结果，

---

<div class="post-metadata">

**Author:** ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)\
**Post date:** [2023年七月10日 06:20 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/7 "2023-07-10T06:20:18Z")

</div>

此帖在另一个主题中很好地总结了这一点：

> [@Scot](#):
>
> 我尝试了“搜索优先最新帖子”，这确实有帮助，因为它会显示更多最新帖子，但不幸的是，它没有按时间顺序排列帖子，所以在查看结果时有点令人困惑。在搜索条件末尾添加“l”似乎与选择“Latest”得到相同的结果，但它在“Sort by”下拉菜单中仍然显示“Relevance”，所以这对用户来说有点令人困惑或误导，因为结果不是按相关性排序的，而且似乎添加字符使得用户实际上无法按相关性搜索。

我个人总是将其更改为“Latest post”，然后再次搜索，通常甚至不看第一个“Relevance”搜索结果。

---

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2023年七月10日 06:22 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/8 "2023-07-10T06:22:38Z")

</div>

我可以帮忙。我看看能不能做一个简单的组件。 😄

---

<div class="post-metadata">

**Author:** ![c12gene](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/c12gene/32/181974_2.png) [@c12gene](https://meta.discourse.org/u/c12gene)\
**Post date:** [2023年七月10日 22:13 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/9 "2023-07-10T22:13:37Z")

</div>

@Arkshine 来了！他构建了一个非常易于安装的组件，完全符合我的预期！谢谢！！！！

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2023年八月9日 22:13 UTC](https://meta.discourse.org/t/need-forum-search-results-to-display-most-recent-posts-by-default-as-opposed-to-oldest/271059/10 "2023-08-09T22:13:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
