# Vanilla Forumsからのインポートで返信が順不同になります。返信を再インデックスしますか？

**URL:** https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847
**Category:** Development
**Created:** [2021 年 11 月 11 日午前 1:19 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847 "2021-11-11T01:19:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [2021 年 11 月 11 日午前 1:19 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/1 "2021-11-11T01:19:27Z")

</div>

Vanilla Forumからのエクスポートを正常にインポートしましたが、一部のトピックの返信が正しい順序になっていません。日によって、または年によって順序が異なります。

問題は、Vanilla Porterが返信を順序どおりにエクスポートしておらず、認識可能なパターンがないことのようです。その後、Discourseインポートスクリプトが一行ずつレコードを適切な場所に配置すると、返信には順序外のIDが付与されます。

考えられるオプションは2つあります。

1. Vanilla Porterを何らかの方法で修正する
2. 作成日を基準にDiscourseデータベース内の返信を再インデックスする

2の方が、もし可能であれば、より簡単だと思われます。

何か提案はありますか？

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [2021 年 11 月 11 日午前 5:35 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/2 "2021-11-11T05:35:46Z")

</div>

コマンドラインにログインし、コンテナに入ってすべての投稿を再ベイクして、それが機能するかどうかを確認します。

```plaintext
cd /var/discourse
./launcher enter app
rake posts:rebake

```

---

<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: [2021 年 11 月 11 日午前 6:14 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/3 "2021-11-11T06:14:43Z")

</div>

特定のrakeタスクがあると思います - `rake posts:reorder_posts`

> [@Moving posts into an existing topic doesn't keep chronology](https://meta.discourse.org/t/moving-posts-into-an-existing-topic-doesnt-keep-chronology/21392/36?u=jammydodger):
>
> I had a need to use this for some email threads that were split into separate topics during import so I thought I would elaborate on this in case anyone else also needs it. You’ll need to be able to access the command line on the server running your Discourse instance. Start by moving all the desired posts into the target topic, then get the topic ID. In the address bar you might see something like the following, where the topic ID is 24855: /t/topic-slug/24855/9 On your server, enter the Di…

---

<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: [2021 年 11 月 11 日午後 12:07 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/4 "2021-11-11T12:07:42Z")

</div>

上記のレーキタスクでうまくいかない場合は、次にインポートスクリプトが投稿を順序付けてインポートするように使用するクエリを調整します。

---

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [2021 年 11 月 11 日午後 12:21 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/5 "2021-11-11T12:21:31Z")

</div>

皆さん、ありがとうございました！うまくいきました。コマンドラインへのアクセスがないため、アクセス権を持つ人がどのコマンドを使用したかの確認を待っています。確認でき次第、このスレッドを更新します。

---

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [2021 年 11 月 11 日午後 2:41 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/6 "2021-11-11T14:41:01Z")

</div>

彼はかなり曖昧でしたが、両方のコマンドを使ったと言っていました。ですから、将来誰かがこれを行う必要がある場合は、両方を試してみてください。もっと具体的に言えなくてすみません。迅速なご支援、ありがとうございました！

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [2021 年 11 月 11 日午後 2:48 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/7 "2021-11-11T14:48:01Z")

</div>

リベイクタスクは不要なはずです。これは投稿の内容を処理しますが、投稿の順序を変更しても変更する必要はありません。

---

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [2021 年 11 月 11 日午後 3:23 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/8 "2021-11-11T15:23:56Z")

</div>

`rake posts:reorder_posts` だけでいいのですか？

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [2021 年 11 月 11 日午後 4:58 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/9 "2021-11-11T16:58:51Z")

</div>

投稿が時系列順でないことだけが問題なのであれば、はい。`posts:reorder_posts` タスクは、まさにその問題のみを処理し、それ以外のことは行いません。

---

<div class="post-metadata">

### Author: ![Nick\_Chomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick_chomey/32/215378_2.png) [@Nick\_Chomey](https://meta.discourse.org/u/Nick_Chomey)
#### Post date: [2021 年 11 月 11 日午後 5:24 UTC](https://meta.discourse.org/t/importing-from-vanilla-forums-results-in-out-of-order-replies-re-index-replies/208847/10 "2021-11-11T17:24:57Z")

</div>

完璧です、明確化ありがとうございます！これが将来誰かの役に立つことを願っています。
