websolr-sunspot_rails 1.1.0.1 → 1.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/websolr-sunspot_rails.rb +39 -20
- data/websolr-sunspot_rails.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.0.
|
1
|
+
1.1.0.2
|
@@ -90,27 +90,46 @@ if ENV["WEBSOLR_URL"]
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
#
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
93
|
+
#
|
94
|
+
# Silently fail instead of raising an exception when an error occurs while writing to Solr.
|
95
|
+
# NOTE: does not fail for reads; you should catch those exceptions, for example in a rescue_from statement.
|
96
|
+
#
|
97
|
+
require 'sunspot/session_proxy/abstract_session_proxy'
|
98
|
+
class WebsolrSilentFailSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy
|
99
|
+
attr_reader :search_session
|
100
|
+
|
101
|
+
delegate :new_search, :search, :config,
|
102
|
+
:new_more_like_this, :more_like_this,
|
103
|
+
:delete_dirty, :delete_dirty?,
|
104
|
+
:to => :search_session
|
105
|
+
|
106
|
+
def initialize(search_session = Sunspot.session)
|
107
|
+
@search_session = search_session
|
108
|
+
end
|
109
|
+
|
110
|
+
def rescued_exception(method, e)
|
111
|
+
$stderr.puts("Exception in #{method}: #{e.message}")
|
112
|
+
end
|
113
|
+
|
114
|
+
SUPPORTED_METHODS = [
|
115
|
+
:batch, :commit, :commit_if_dirty, :commit_if_delete_dirty, :dirty?,
|
116
|
+
:index!, :index, :remove!, :remove, :remove_all!, :remove_all,
|
117
|
+
:remove_by_id!, :remove_by_id
|
118
|
+
]
|
119
|
+
|
120
|
+
SUPPORTED_METHODS.each do |method|
|
121
|
+
module_eval(<<-RUBY)
|
122
|
+
def #{method}(*args, &block)
|
123
|
+
begin
|
124
|
+
search_session.#{method}(*args, &block)
|
125
|
+
rescue => e
|
126
|
+
self.rescued_exception(:#{method}, e)
|
111
127
|
end
|
112
128
|
end
|
113
|
-
|
129
|
+
RUBY
|
114
130
|
end
|
115
|
-
end
|
131
|
+
end
|
132
|
+
|
133
|
+
Sunspot.session = WebsolrSilentFailSessionProxy.new(Sunspot.session)
|
134
|
+
|
116
135
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{websolr-sunspot_rails}
|
8
|
-
s.version = "1.1.0.
|
8
|
+
s.version = "1.1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kyle Maxwell", "John Barnette", "Mat Brown", "Nick Zadrozny"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-15}
|
13
13
|
s.description = %q{websolr to sunspot_rails shim}
|
14
14
|
s.email = %q{kyle@kylemaxwell.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websolr-sunspot_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 83
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.1.0.
|
10
|
+
- 2
|
11
|
+
version: 1.1.0.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Kyle Maxwell
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2010-
|
22
|
+
date: 2010-06-15 00:00:00 -07:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|