# How Regenerate droped table post\_search\_data?

**URL:** https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953
**Category:** Development
**Created:** [1월 18, 2017, 8:13오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953 "2017-01-18T08:13:38Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 18, 2017, 8:13오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/1 "2017-01-18T08:13:38Z")

</div>

By mistake i delete the table post\_search\_data in discourse data, How this table can be regenerated ? As this table depend upon the table posts, there might be a way to regenrate it, please help.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [1월 18, 2017, 9:36오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/2 "2017-01-18T09:36:45Z")

</div>

Do you have a backup?

---

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 18, 2017, 10:02오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/3 "2017-01-18T10:02:01Z")

</div>

not have backup, is there not a way to populate the tsvector directly with PSQL and the raw also, using ssh ?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [1월 18, 2017, 2:42오후 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/4 "2017-01-18T14:42:42Z")

</div>

There is a rake tast that regenerates the index

```plaintext
./launcher enter app
rake search:reindex

```

I would strongly recommend restoring from a backup though if you have started mucking around with tables. Who knows what else happened.

---

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 18, 2017, 6:13오후 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/5 "2017-01-18T18:13:23Z")

</div>

thank you very much sir, next time i keep a backup, before playing with tables.

---

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 18, 2017, 6:19오후 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/6 "2017-01-18T18:19:48Z")

</div>

sorry forgot to mention, i am on development enviorment not docker. what should i run in ruby ?  
should i run this ? but how ? what command exact command ?  
discourse/app/services/search\_indexer.rb  
i am running  
rake search:reindex lets see

thanks it saved my big time.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [1월 20, 2017, 12:41오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/7 "2017-01-20T00:41:43Z")

</div>

If you’ve nothing important in **development mode** , you can run the following commands to recreate the entire db

```plaintext
rake db:drop db:create db:migrate

```

---

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 20, 2017, 9:22오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/8 "2017-01-20T09:22:08Z")

</div>

SIR, I am import DB in development to use it in production, if i use it, it will reset the db ???

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [1월 20, 2017, 9:31오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/9 "2017-01-20T09:31:14Z")

</div>

Yes, it will reset the DB. But doing this and re-running the import may be the sanest way forward if you messed with the database…

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [1월 20, 2017, 9:35오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/10 "2017-01-20T09:35:05Z")

</div>

Yea don’t run it if you have any **important data that you can’t recreate** in development mode.

---

<div class="post-metadata">

### Author: ![veer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/veer/32/69391_2.png) [@veer](https://meta.discourse.org/u/veer)
#### Post date: [1월 20, 2017, 10:26오전 UTC](https://meta.discourse.org/t/how-regenerate-droped-table-post-search-data/55953/11 "2017-01-20T10:26:52Z")

</div>

> [@sam](#):
>
> rake search:reindex

Thanks, it helped a lot.
