sunspot:solr:reindex in production

148 views
Skip to first unread message

doktor....@gmail.com

unread,
Mar 11, 2014, 9:07:57 AM3/11/14
to ruby-s...@googlegroups.com
looks like trivial question, tried to google it - no luck

so,

if i run sunspot:solr:reindex in production it deletes all recent results and i receive site without (all) content until it finish this job

is it possible to reindex all models from command prompt "over the top" of old results to avoid situation i described?

thanks

Mark Weston

unread,
Mar 12, 2014, 8:07:03 AM3/12/14
to ruby-s...@googlegroups.com
I don't think there are any easy answers to this one (or if someone has one, I've missed it).

If your application requires regular full reindexing, as ours does, your options are limited.  What we're playing with right now is a multicore Solr setup with one live core being used by the live application, while we fully reindex the second (offline) core.  Then we simply switch which core the live application points to.  Voila, full reindex with no downtime on search.

Or at least, that's our hope.  This isn't in production yet so I don't know if we've found all the possible gotchas.


--
You received this message because you are subscribed to the Google Groups "Sunspot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-sunspot...@googlegroups.com.
To post to this group, send email to ruby-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-sunspot.
For more options, visit https://groups.google.com/d/optout.

James

unread,
Mar 12, 2014, 1:58:52 PM3/12/14
to ruby-s...@googlegroups.com, doktor....@gmail.com
Well, it looks like the task calls model.solr_reindex which is actually a two line method.  It calls solr_remove_all_from_index and then solr_index

Could you make your own rake task that calls solr_index on each model, and then solr_clean_index_orphans on each model?  I don't have great familiarity with Solr, does anyone know of doing things in that order would cause problems?

Mark Weston

unread,
Mar 15, 2014, 10:24:02 AM3/15/14
to ruby-s...@googlegroups.com
That's interesting.  I didn't know of the existence of solr_clean_index_orphans.

The problem we're trying to deal with is indexing after a batch update to our live user-facing database (from our CMS system) and worries about how search on the live system behaves while reindexing is in progress.  Hmm.


--
Reply all
Reply to author
Forward
0 new messages