lib/thinking_sphinx/tasks.rb in skalee-thinking-sphinx-1.3.14.1 vs lib/thinking_sphinx/tasks.rb in skalee-thinking-sphinx-1.3.14.2

- old
+ new

@@ -94,10 +94,23 @@ task :rebuild => :app_env do Rake::Task["thinking_sphinx:stop"].invoke if sphinx_running? Rake::Task["thinking_sphinx:index"].invoke Rake::Task["thinking_sphinx:start"].invoke end + + desc "Reindex delta indexes (all the indexes with name ending with _delta)" + task :reindex_delta => :app_env do + config = ThinkingSphinx::Configuration.instance + FileUtils.mkdir_p config.searchd_file_path + + index_names = ThinkingSphinx.context.indexed_models.map do |model| + model.constantize.to_riddle.select{ |index| /_delta\Z/ =~ index.name }.map(&:name) + end.flatten.join(' ') + + puts config.controller.index index_names + end + end namespace :ts do desc "Output the current Thinking Sphinx version" task :version => "thinking_sphinx:version" @@ -118,9 +131,11 @@ task :conf => "thinking_sphinx:configure" desc "Generate the Sphinx configuration file using Thinking Sphinx's settings" task :config => "thinking_sphinx:configure" desc "Stop Sphinx (if it's running), rebuild the indexes, and start Sphinx" task :rebuild => "thinking_sphinx:rebuild" + desc "Reindex delta indexes (all the indexes with name ending with _delta)" + task :din => "thinking_sphinx:reindex_delta" end def sphinx_pid ThinkingSphinx.sphinx_pid end