Modified: trunk/Rakefile (3752 => 3753)
--- trunk/Rakefile 2013-10-08 14:36:04 UTC (rev 3752)
+++ trunk/Rakefile 2013-10-08 15:40:31 UTC (rev 3753)
@@ -17,6 +17,7 @@
rescue LoadError
STDERR.puts "Run `rake gems:install` to install delayed_job"
end
+
desc 'Rebuild Solr index'
task "myexp:refresh:solr" do
require File.dirname(__FILE__) + '/config/environment'
@@ -28,6 +29,28 @@
Service.solr_reindex
end
+desc 'Start the search engine'
+task "myexp:search:start" do
+ require File.dirname(__FILE__) + '/config/environment'
+
+ search_start
+end
+
+desc 'Stop the search engine'
+task "myexp:search:stop" do
+ require File.dirname(__FILE__) + '/config/environment'
+
+ search_stop
+end
+
+desc 'Restart the search engine'
+task "myexp:search:restart" do
+ require File.dirname(__FILE__) + '/config/environment'
+
+ search_stop
+ search_start
+end
+
desc 'Refresh contribution caches'
task "myexp:refresh:contributions" do
require File.dirname(__FILE__) + '/config/environment'
@@ -366,3 +389,12 @@
conn.execute('UPDATE content_blobs SET sha1 = SHA1(data), md5 = MD5(data)')
end
+def search_start
+ port = YAML.load(File.read("config/sunspot.yml"))[Rails.env]["solr"]["port"]
+ `sunspot-solr start -p #{port} -s solr -d solr/data --log-file log/sunspot.log >> log/sunspot-solr.out`
+end
+
+def search_stop
+ port = YAML.load(File.read("config/sunspot.yml"))[Rails.env]["solr"]["port"]
+ `sunspot-solr stop -p #{port}`
+end