Reputation: 9665
I have a cron which does the solr rebuild job.
The Cron run clear index
command which deletes the current indexes. Now the problem is this cause the SOLR Search feature to go down on the website till new new indexes are available.
How to ensure that old indexes are available, till the new indexes aren't available?
Upvotes: 1
Views: 861
Reputation: 52902
Don't run the clear index command. Issue a delete of all the documents (for example by sending <delete><query>*:*</query></delete>
) without issuing a commit.
Index all the new documents, and when finished, issue the commit. Solr won't make the changes visible before the commit is issued, and continues to serve the old content until you tell it to expunge the old content and use the new instead.
Another option is to create a new core as a copy of the old one, index to that core and then switch the cores when indexing is finished. That way old queries will be running against the existing core until the new one is ready, then after switching you can remove the old core.
This can be implemented by using the collection alias feature if running in SolrCloud mode, or by using the core swap feature if running as a traditional single instance.
Upvotes: 3