Skip to content

Commit

Permalink
Distinguish between full clear (used by rebuild) and real-time-only c…
Browse files Browse the repository at this point in the history
…lear.
  • Loading branch information
pat committed Nov 4, 2014
1 parent 096e5c4 commit 303eebc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/thinking_sphinx/rake_interface.rb
@@ -1,5 +1,14 @@
class ThinkingSphinx::RakeInterface
def clear
def clear_all
[
configuration.indices_location,
configuration.searchd.binlog_path
].each do |path|
FileUtils.rm_r(path) if File.exists?(path)
end
end

def clear_real_time
indices = configuration.indices.select { |index| index.type == 'rt' }
indices.each do |index|
index.render
Expand Down
9 changes: 7 additions & 2 deletions lib/thinking_sphinx/tasks.rb
Expand Up @@ -14,7 +14,12 @@

desc 'Clear out Sphinx files'
task :clear => :environment do
interface.clear
interface.clear_all
end

desc 'Clear out real-time index files'
task :clear_rt => :environment do
interface.clear_real_time
end

desc 'Generate fresh index files for real-time indices'
Expand All @@ -27,7 +32,7 @@
task :rebuild => [:stop, :clear, :index, :start]

desc 'Stop Sphinx, clear files, reconfigure, start Sphinx, generate files'
task :regenerate => [:stop, :clear, :configure, :start, :generate]
task :regenerate => [:stop, :clear_rt, :configure, :start, :generate]

desc 'Restart the Sphinx daemon'
task :restart => [:stop, :start]
Expand Down

0 comments on commit 303eebc

Please sign in to comment.