# 是否启用仅限登录用户搜索的选项？

**URL:** <https://meta.discourse.org/t/option-to-enable-search-for-logged-in-users-only/256772>\
**Category:** Feature\
**Tags:** search\
**Created:** [2023年三月2日 05:24 UTC](https://meta.discourse.org/t/option-to-enable-search-for-logged-in-users-only/256772 "2023-03-02T05:24:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)\
**Post date:** [2026年八月29日 22:19 UTC](https://meta.discourse.org/t/option-to-enable-search-for-logged-in-users-only/256772/4 "2026-08-29T22:19:10Z")

</div>

> [@opcourdis](#):
>
> ```plaintext
> env:
> DISCOURSE_RATE_LIMIT_SEARCH_ANON_GLOBAL_PER_MINUTE: 0
> 
> ```

我正在尝试这样做，但现在直接链接到搜索页面只会返回以下 JSON：

```plaintext
{
  "failed":"FAILED",
  "message":"You’ve performed this action too many times, please try again later."
}

```

还有其他方法可以实现吗？

我不允许匿名用户搜索论坛的原因是，一个复杂的机器人正在使用类似这样的查询抓取数据：

```plaintext
/search?q=%40UserName+%23general+in%3Afirst

```

看起来他们正在对某些用户及其内容进行映射，用于某种数据挖掘任务。为了保护用户数据，我想阻止任何匿名访问搜索功能。问题在于，论坛中存在指向搜索页面的内部链接，因此任何未登录的用户点击这些链接时，都会遇到那个错误的 JSON 消息。

我修改了主题，使得用户在登录之前找不到搜索框，但任何点击现有搜索结果链接的匿名用户都会看到那个 JSON。

今天在我阻止之前，他们向论坛发送了数万次请求。

---

_[View the full topic](https://meta.discourse.org/t/option-to-enable-search-for-logged-in-users-only/256772)._
