我正在关注这个在 Capistrano https://gist.github.com/doitian/1795439中添加 Sunspot Solr 的片段,它可以工作,但是当我运行 cap solr:reindex 时,它会显示一个问题(如预期的那样),询问我是否想要删除所有索引,所以我回答“是”,但终端似乎正在等待响应。
这是重新索引的代码:
desc "reindex the whole database"
task :reindex, :roles => :app do
stop
run "rm -rf #{shared_path}/solr/data"
start
run "cd #{current_path} && #{rake} RAILS_ENV=#{rails_env} sunspot:solr:reindex"
end
这是消息:
* executing "cd /home/user/rapps/app/current && bundle exec rake RAILS_ENV=production sunspot:solr:reindex"
servers: ["9.9.9.9"]
[9.9.9.9] executing command
** [out :: 9.9.9.9] *Note: the reindex task will remove your current indexes and start from scratch.
** [out :: 9.9.9.9] If you have a large dataset, reindexing can take a very long time, possibly weeks.
** [out :: 9.9.9.9] This is not encouraged if you have anywhere near or over 1 million rows.
** [out :: 9.9.9.9] Are you sure you want to drop your indexes and completely reindex? (y/n)
y
如何避免该消息?另外,我想用 Cron 运行这个 rake,那么我之前怎么能给出答案或设置默认配置?什么是重新索引的最佳/有效方法?
提前致谢。