Search code examples
ruby-on-railselasticsearchsearchkickruby-paranoia

How to reindex archived as well as non archived data using searchkick


I have a Meeting model which contains archived as well as non archived data.

When I am running Model.reindex only non archived data is getting indexed.

I want to index non archived data as well so that I can see non archived data as well when using search method of searchkick.

For archiving I have used paranoia gem and archived column name is cancelled_at.


Solution

  • Model.with_deleted.reindex
    

    Since paranoia gem default_scope is always without the deleted/archived ones just have to use the helper scope that is documented in the paranoia readme https://github.com/rubysherpas/paranoia#usage