sunspot_rails 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem 'rails', '3.2.3'
|
4
|
+
gem 'sqlite3-ruby', '~> 1.3.1'
|
5
|
+
|
6
|
+
gem 'sunspot', :path => File.expand_path('../../../sunspot', __FILE__)
|
7
|
+
gem 'sunspot_solr', :path => File.expand_path('../../../sunspot_solr', __FILE__)
|
8
|
+
gem 'sunspot_rails', :path => File.expand_path('../..', __FILE__)
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'rspec-rails', '~> 2.8.1'
|
12
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sunspot
|
2
2
|
module Rails
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
|
-
initializer 'sunspot_rails.init' do
|
4
|
+
initializer 'sunspot_rails.init', :before=> :load_config_initializers do
|
5
5
|
Sunspot.session = Sunspot::Rails.build_session
|
6
6
|
ActiveSupport.on_load(:active_record) do
|
7
7
|
Sunspot::Adapters::InstanceAdapter.register(Sunspot::Rails::Adapters::ActiveRecordInstanceAdapter, ActiveRecord::Base)
|
@@ -7,12 +7,11 @@ module Sunspot
|
|
7
7
|
alias_method_chain :execute, :as_instrumentation
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
10
|
+
|
11
|
+
def execute_with_as_instrumentation(path, params={}, *extra)
|
12
|
+
ActiveSupport::Notifications.instrument("request.rsolr",
|
13
|
+
{:path => path, :parameters => params}) do
|
14
|
+
execute_without_as_instrumentation(path, params, *extra)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/lib/sunspot/rails/tasks.rb
CHANGED
@@ -15,6 +15,10 @@ namespace :sunspot do
|
|
15
15
|
# # batchs of 1000
|
16
16
|
# $ rake sunspot:reindex[,Post+Author] # reindex Post and Author model
|
17
17
|
task :reindex, [:batch_size, :models] => [:environment] do |t, args|
|
18
|
+
|
19
|
+
# Retry once or gracefully fail for a 5xx error so we don't break reindexing
|
20
|
+
Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)
|
21
|
+
|
18
22
|
# Set up general options for reindexing
|
19
23
|
reindex_options = { :batch_commit => false }
|
20
24
|
|
@@ -48,18 +52,22 @@ namespace :sunspot do
|
|
48
52
|
rescue Exception => e
|
49
53
|
$stderr.puts "Error using progress bar: #{e.message}"
|
50
54
|
end
|
51
|
-
|
55
|
+
|
52
56
|
# Finally, invoke the class-level solr_reindex on each model
|
53
57
|
sunspot_models.each do |model|
|
54
58
|
model.solr_reindex(reindex_options)
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
62
|
+
def sunspot_solr_in_load_path?
|
63
|
+
# http://www.rubular.com/r/rJGDh7eOSc
|
64
|
+
$:.any? { |path| path =~ %r{sunspot_solr(-[^/]+)?/lib$} }
|
65
|
+
end
|
58
66
|
|
59
|
-
unless
|
67
|
+
unless sunspot_solr_in_load_path?
|
60
68
|
namespace :solr do
|
61
|
-
|
62
|
-
|
69
|
+
task :moved_to_sunspot_solr do
|
70
|
+
abort %(
|
63
71
|
Note: This task has been moved to the sunspot_solr gem. To install, start and
|
64
72
|
stop a local Solr instance, please add sunspot_solr to your Gemfile:
|
65
73
|
|
@@ -68,17 +76,19 @@ namespace :sunspot do
|
|
68
76
|
end
|
69
77
|
|
70
78
|
)
|
71
|
-
|
72
|
-
|
79
|
+
end
|
80
|
+
|
73
81
|
desc 'Start the Solr instance'
|
74
82
|
task :start => :moved_to_sunspot_solr
|
83
|
+
|
75
84
|
desc 'Run the Solr instance in the foreground'
|
76
85
|
task :run => :moved_to_sunspot_solr
|
86
|
+
|
77
87
|
desc 'Stop the Solr instance'
|
78
88
|
task :stop => :moved_to_sunspot_solr
|
79
|
-
|
89
|
+
|
90
|
+
# for backwards compatibility
|
80
91
|
task :reindex => :"sunspot:reindex"
|
81
92
|
end
|
82
93
|
end
|
83
|
-
|
84
94
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 1.3.
|
8
|
+
- 2
|
9
|
+
version: 1.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mat Brown
|
@@ -32,7 +32,7 @@ autorequire:
|
|
32
32
|
bindir: bin
|
33
33
|
cert_chain: []
|
34
34
|
|
35
|
-
date: 2012-
|
35
|
+
date: 2012-05-13 00:00:00 -07:00
|
36
36
|
default_executable:
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -45,8 +45,8 @@ dependencies:
|
|
45
45
|
segments:
|
46
46
|
- 1
|
47
47
|
- 3
|
48
|
-
-
|
49
|
-
version: 1.3.
|
48
|
+
- 2
|
49
|
+
version: 1.3.2
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id001
|
52
52
|
- !ruby/object:Gem::Dependency
|
@@ -110,8 +110,9 @@ files:
|
|
110
110
|
- dev_tasks/spec.rake
|
111
111
|
- dev_tasks/todo.rake
|
112
112
|
- gemfiles/rails-2.3.14
|
113
|
-
- gemfiles/rails-3.0.
|
114
|
-
- gemfiles/rails-3.1.
|
113
|
+
- gemfiles/rails-3.0.12
|
114
|
+
- gemfiles/rails-3.1.4
|
115
|
+
- gemfiles/rails-3.2.3
|
115
116
|
- generators/sunspot/sunspot_generator.rb
|
116
117
|
- generators/sunspot/templates/sunspot.yml
|
117
118
|
- install.rb
|