# 主题未被删除

**URL:** https://meta.discourse.org/t/topics-are-not-deleted/242694
**Category:** Support
**Created:** [2022年十月23日 05:47 UTC](https://meta.discourse.org/t/topics-are-not-deleted/242694 "2022-10-23T05:47:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![danielabc](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@danielabc](https://meta.discourse.org/u/danielabc)
#### Post date: [2022年十月23日 05:47 UTC](https://meta.discourse.org/t/topics-are-not-deleted/242694/1 "2022-10-23T05:47:15Z")

</div>

我使用了命令

```plaintext
rake destroy:topics["#"]

```

来删除主题，事实上论坛菜单中的所有主题都不再显示，但如果我搜索它们，它们仍然会出现！

这不应该删除所有内容吗？

---

<div class="post-metadata">

### Author: ![yhh9xdq7dc](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@yhh9xdq7dc](https://meta.discourse.org/u/yhh9xdq7dc)
#### Post date: [2022年十月23日 08:27 UTC](https://meta.discourse.org/t/topics-are-not-deleted/242694/2 "2022-10-23T08:27:05Z")

</div>

我也有这个问题。

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年十月23日 09:05 UTC](https://meta.discourse.org/t/topics-are-not-deleted/242694/4 "2022-10-23T09:05:24Z")

</div>

据我所知，rake destroy 任务不会从数据库中删除数据，它们只会进行软删除。要进行硬删除，您需要访问 rails 控制台。

我的 rails 技能不是很好，所以我不敢提供任何具体的建议，尤其是对于这么大的工作 🙂，但有一些现有的建议可以用来研究您需要做什么。例如：

> [@How to delete thousands of Personal Messages?](https://meta.discourse.org/t/how-to-deleting-thousands-of-private-message/162747/7?u=jammydodger):
>
> Revisiting this old topic, since none of the answers are 100% correct. The rake task rake destroy:private\_messages does not hard delete all private messages, it soft deletes them. They can still be seen by an admin and they can be recovered. The Rails code Topic.where(archetype: 'private\_message').where("user\_id \> 0").destroy\_all destroys the topics, but not the actual messages. They are still in the database and can be viewed using for instance the [data explorer](https://meta.discourse.org/t/32566?silent=true) plugin. This code will perma…

---

<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: [2022年十月23日 16:24 UTC](https://meta.discourse.org/t/topics-are-not-deleted/242694/5 "2022-10-23T16:24:19Z")

</div>

如果您点击搜索中的那些主题，您能看到它们吗？

我不确定您是否看到已软删除的主题，或者您看到的是自主题删除以来未刷新的搜索索引。
