Commit 45817046dfa142652d0ea285792084e4b5adfa78
Exists in
master
and in
21 other branches
Merge branch 'dferrazm-master'
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
README.md
@@ -849,6 +849,25 @@ product.reindex | @@ -849,6 +849,25 @@ product.reindex | ||
849 | product.reindex_async | 849 | product.reindex_async |
850 | ``` | 850 | ``` |
851 | 851 | ||
852 | +Reindex more than one record without recreating the index | ||
853 | + | ||
854 | +```ruby | ||
855 | +# do this ... | ||
856 | +some_company.products.each { |p| p.reindex } | ||
857 | +# or this ... | ||
858 | +Product.searchkick_index.import(some_company.products) | ||
859 | +# don't do the following as it will recreate the index with some_company's products only | ||
860 | +some_company.products.reindex | ||
861 | +``` | ||
862 | + | ||
863 | +Reindex large set of records in batches | ||
864 | + | ||
865 | +```ruby | ||
866 | +Product.where("id > 100000").find_in_batches do |batch| | ||
867 | + Product.searchkick_index.import(batch) | ||
868 | +end | ||
869 | +``` | ||
870 | + | ||
852 | Remove old indices | 871 | Remove old indices |
853 | 872 | ||
854 | ```ruby | 873 | ```ruby |