My application usually takes 20 minutes to reindex as a whole. There is a small table with a couple of records which I want to reindex again. I want to save time so I ran the command rake sunspot:solr:reindex[500,Deal]
. This is taken straight from the Github readme and is suppose to reindex one model only.
The time it takes to reindex in this command is still 20 minutes, so there is no difference in the time taken. Am I doing something wrong?
I was in the same situation of you asking why it takes the same time.
The solution: erase the ":solr". Just write:
rake sunspot:reindex[batch_size,Model]
If you don't specify the batch_size you have tu put a comma "," like:
rake sunspot:reindex[,model]
I now go into Rails console and call reindex from there:
Deal.solr_reindex(:batch_size => 1000, :include => :period)
This works great as I can now reindex only one model, include related tables to improve speed. Previously it is only indexing at 200/sec, and now it is at 1000/sec.
(In fact, since reindexing through console or rake will clear the index file, resulting in a short period of empty index, I now call solr_index
most of the time to update the index.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With