As mentioned by Jason, you can call Sunspot.commit_if_dirty
to issue a commit from your client.
From the server configuration side, another approach would be to set the autoCommit
property in your solrconfig.xml
to automatically issue commits when there have been changes made to your index. A maxTime
of 60000 ms (one minute) should suffice for most sites.
Using autoCommit
is probably the wiser choice in production applications, where a high volume of commits can easily impact your Solr server's performance. In fact, it's a good practice with Sunspot to disable its auto_commit_after_request option
when your site starts getting a decent amount of updates.
Lastly, autoCommit
has the advantage of being able to set it and forget it.
At Websolr, our default is to ignore client-issued commits in favor of autoCommit
.
sunspot_rails
, not just 'sunspot'. For two, the Answers suggested discuss things that are moot because of sunspot_rails's default sunspot settings. – Paulson