Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i manually reindex solr using sunspot?

I have couchdb. Sunspot was correctly indexing everything. But the Solr server crashed. I need to reindex the whole thing. rake sunspot:reindex wont work as it is tigthly coupled with active record. sunspot.index(model.all) didnt work. the solr core says 0 indexed docs even after doing that. is there a way out?

like image 556
Mahesh M Avatar asked Nov 24 '11 03:11

Mahesh M


1 Answers

Post.solr_reindex

There are a number of options that can be passed to solr_reindex. The same options as to index; from the documentation

index in batches of 50, commit after each

Post.index 

index all rows at once, then commit

Post.index(:batch_size => nil) 

index in batches of 50, commit when all batches complete

Post.index(:batch_commit => false) 

include the associated +author+ object when loading to index

Post.index(:include => :author) 
like image 113
s01ipsist Avatar answered Oct 09 '22 08:10

s01ipsist