Commit a8592a9b27bc33d407328a0b56db4a35d65b9b80

Authored by Andrew Kane
1 parent 79d36e86

Added asynchronous reindexing to readme

Showing 1 changed file with 17 additions and 0 deletions   Show diff stats
README.md
... ... @@ -655,6 +655,23 @@ class Product < ActiveRecord::Base
655 655 end
656 656 ```
657 657  
  658 +Asynchronous reindexing
  659 +
  660 +```ruby
  661 +class Product < ActiveRecord::Base
  662 + searchkick callbacks: false
  663 +
  664 + # add the callbacks manually
  665 + after_save :reindex_async
  666 + after_destroy :reindex_async
  667 +
  668 + def reindex_async
  669 + # delayed job
  670 + delay.reindex
  671 + end
  672 +end
  673 +```
  674 +
658 675 Reindex all models (Rails only)
659 676  
660 677 ```sh
... ...