Commit 1fd27503c7db27301ed5c3ec6a6e242fb552b439
Exists in
master
and in
21 other branches
Merge branch 'master' of https://github.com/dferrazm/searchkick into dferrazm-master
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -849,6 +849,25 @@ product.reindex |
849 | 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 | 871 | Remove old indices |
853 | 872 | |
854 | 873 | ```ruby | ... | ... |