sunspot 2.6.0 → 2.7.0
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.
- checksums.yaml +4 -4
- data/lib/sunspot/session.rb +1 -1
- data/lib/sunspot/util.rb +20 -10
- data/lib/sunspot/version.rb +1 -1
- data/spec/api/binding_spec.rb +15 -0
- data/spec/api/indexer/attributes_spec.rb +1 -1
- data/spec/api/query/geo_examples.rb +1 -1
- data/spec/api/session_proxy/master_slave_session_proxy_spec.rb +1 -1
- data/spec/api/session_proxy/retry_5xx_session_proxy_spec.rb +8 -5
- data/spec/api/session_spec.rb +1 -1
- data/spec/mocks/comment.rb +1 -1
- data/sunspot.gemspec +5 -5
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06d94f7de37bd42e2766b04b245a4529620124558e275e7f6a0aca6b905978ab
|
4
|
+
data.tar.gz: 1966e3348ed17403862dc3d677225e2da0da85d62b6d1071f1c7ad7d9a3c423c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93134646633877883e4b3ea6b6f8308f4c40d2806daf78a249816bf92dddf7ca80c0f06e48a12a5e85c84665e26fb0666d181a5b71ba8c88462ccd2a6160479e
|
7
|
+
data.tar.gz: c31692b2cb14e5cae05ecc294f5d9ce7fb761d9712ad838a78f037eb3a107c03d05c13e6ef2f52055d32047a0fd9679ea044ac16156cf90c1464e510a3ee3fb0
|
data/lib/sunspot/session.rb
CHANGED
@@ -256,7 +256,7 @@ module Sunspot
|
|
256
256
|
def connection
|
257
257
|
@connection ||= self.class.connection_class.connect(
|
258
258
|
url: config.solr.url,
|
259
|
-
|
259
|
+
timeout: config.solr.read_timeout,
|
260
260
|
open_timeout: config.solr.open_timeout,
|
261
261
|
proxy: config.solr.proxy,
|
262
262
|
update_format: update_format
|
data/lib/sunspot/util.rb
CHANGED
@@ -248,7 +248,7 @@ module Sunspot
|
|
248
248
|
Coordinates = Struct.new(:lat, :lng)
|
249
249
|
|
250
250
|
class ContextBoundDelegate
|
251
|
-
class <<self
|
251
|
+
class << self
|
252
252
|
def instance_eval_with_context(receiver, &block)
|
253
253
|
calling_context = eval('self', block.binding)
|
254
254
|
if parent_calling_context = calling_context.instance_eval{@__calling_context__ if defined?(@__calling_context__)}
|
@@ -289,21 +289,31 @@ module Sunspot
|
|
289
289
|
__proxy_method__(:sub, *args, &block)
|
290
290
|
end
|
291
291
|
|
292
|
-
def method_missing(method, *args, &block)
|
293
|
-
__proxy_method__(method, *args, &block)
|
292
|
+
def method_missing(method, *args, **kwargs, &block)
|
293
|
+
__proxy_method__(method, *args, **kwargs, &block)
|
294
294
|
end
|
295
295
|
|
296
|
-
def
|
297
|
-
|
296
|
+
def respond_to_missing?(method, _)
|
297
|
+
@__receiver__.respond_to?(method, true) || super
|
298
|
+
end
|
299
|
+
|
300
|
+
def __proxy_method__(method, *args, **kwargs, &block)
|
301
|
+
if kwargs.empty?
|
298
302
|
@__receiver__.__send__(method.to_sym, *args, &block)
|
299
|
-
|
300
|
-
|
303
|
+
else
|
304
|
+
@__receiver__.__send__(method.to_sym, *args, **kwargs, &block)
|
305
|
+
end
|
306
|
+
rescue ::NoMethodError => e
|
307
|
+
begin
|
308
|
+
if kwargs.empty?
|
301
309
|
@__calling_context__.__send__(method.to_sym, *args, &block)
|
302
|
-
|
303
|
-
|
310
|
+
else
|
311
|
+
@__calling_context__.__send__(method.to_sym, *args, **kwargs, &block)
|
304
312
|
end
|
313
|
+
rescue ::NoMethodError
|
314
|
+
raise(e)
|
305
315
|
end
|
306
|
-
end
|
316
|
+
end
|
307
317
|
end
|
308
318
|
end
|
309
319
|
end
|
data/lib/sunspot/version.rb
CHANGED
data/spec/api/binding_spec.rb
CHANGED
@@ -36,6 +36,17 @@ describe "DSL bindings" do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
expect(value).to eq('value')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should give access to calling context\'s methods with keyword arguments' do
|
43
|
+
value = nil
|
44
|
+
session.search(Post) do
|
45
|
+
any_of do
|
46
|
+
value = kwargs_method(a: 10, b: 20)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
expect(value).to eq({ a: 10, b: 20 })
|
39
50
|
end
|
40
51
|
|
41
52
|
private
|
@@ -47,4 +58,8 @@ describe "DSL bindings" do
|
|
47
58
|
def id
|
48
59
|
16
|
49
60
|
end
|
61
|
+
|
62
|
+
def kwargs_method(a:, b:)
|
63
|
+
{ a: a, b: b }
|
64
|
+
end
|
50
65
|
end
|
@@ -98,7 +98,7 @@ describe 'indexing attribute fields', :type => :indexer do
|
|
98
98
|
|
99
99
|
it 'should index latitude and longitude passed as non-Floats' do
|
100
100
|
coordinates = Sunspot::Util::Coordinates.new(
|
101
|
-
BigDecimal
|
101
|
+
BigDecimal('40.7'), BigDecimal('-73.5'))
|
102
102
|
session.index(post(:coordinates => coordinates))
|
103
103
|
expect(connection).to have_add_with(:coordinates_s => 'dr5xx3nytvgs')
|
104
104
|
end
|
@@ -10,7 +10,7 @@ shared_examples_for 'geohash query' do
|
|
10
10
|
|
11
11
|
it 'searches for nearby points with non-Float arguments' do
|
12
12
|
search do
|
13
|
-
with(:coordinates).near(BigDecimal
|
13
|
+
with(:coordinates).near(BigDecimal('40.7'), BigDecimal('-73.5'))
|
14
14
|
end
|
15
15
|
expect(connection).to have_last_search_including(:q, build_geo_query)
|
16
16
|
end
|
@@ -38,7 +38,7 @@ describe Sunspot::SessionProxy::MasterSlaveSessionProxy do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should raise ArgumentError when bogus config specified' do
|
41
|
-
expect { @proxy.config(:bogus) }.to raise_error
|
41
|
+
expect { @proxy.config(:bogus) }.to raise_error(ArgumentError)
|
42
42
|
end
|
43
43
|
|
44
44
|
it_should_behave_like 'session proxy'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
describe Sunspot::SessionProxy::Retry5xxSessionProxy do
|
4
|
-
|
4
|
+
|
5
5
|
before :each do
|
6
6
|
Sunspot::Session.connection_class = Mock::ConnectionFactory.new
|
7
7
|
@sunspot_session = Sunspot.session
|
@@ -21,11 +21,14 @@ describe Sunspot::SessionProxy::Retry5xxSessionProxy do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
let :fake_rsolr_request do
|
24
|
-
{:uri => 'http://solr.test/uri'}
|
24
|
+
{:uri => URI('http://solr.test/uri')}
|
25
25
|
end
|
26
26
|
|
27
27
|
def fake_rsolr_response(status)
|
28
|
-
{
|
28
|
+
{
|
29
|
+
:status => status.to_s,
|
30
|
+
:body => ''
|
31
|
+
}
|
29
32
|
end
|
30
33
|
|
31
34
|
let :post do
|
@@ -67,12 +70,12 @@ describe Sunspot::SessionProxy::Retry5xxSessionProxy do
|
|
67
70
|
it "should not retry a 4xx" do
|
68
71
|
e = FakeRSolrErrorHttp.new(fake_rsolr_request, fake_rsolr_response(400))
|
69
72
|
expect(@sunspot_session).to receive(:index).and_raise(e)
|
70
|
-
expect { Sunspot.index(post) }.to raise_error
|
73
|
+
expect { Sunspot.index(post) }.to raise_error(FakeRSolrErrorHttp)
|
71
74
|
end
|
72
75
|
|
73
76
|
# TODO: try against more than just Sunspot.index? but that's just testing the
|
74
77
|
# invocation of delegate, so probably not important. -nz 11Apr12
|
75
78
|
|
76
79
|
it_should_behave_like 'session proxy'
|
77
|
-
|
80
|
+
|
78
81
|
end
|
data/spec/api/session_spec.rb
CHANGED
@@ -109,7 +109,7 @@ describe 'Session' do
|
|
109
109
|
it 'should open a connection with custom read timeout' do
|
110
110
|
Sunspot.config.solr.read_timeout = 0.5
|
111
111
|
Sunspot.commit
|
112
|
-
expect(connection.opts[:
|
112
|
+
expect(connection.opts[:timeout]).to eq(0.5)
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'should open a connection with custom open timeout' do
|
data/spec/mocks/comment.rb
CHANGED
data/sunspot.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
'Dylan Vaughn', 'Brian Durand', 'Sam Granieri', 'Nick Zadrozny', 'Jason Ronallo', 'Ryan Wallace', 'Nicholas Jakobsen',
|
12
12
|
'Bragadeesh J', 'Ethiraj Srinivasan']
|
13
13
|
s.email = ["mat@patch.com"]
|
14
|
-
s.homepage = "
|
14
|
+
s.homepage = "https://sunspot.github.io"
|
15
15
|
s.summary = 'Library for expressive, powerful interaction with the Solr search engine'
|
16
16
|
s.license = 'MIT'
|
17
17
|
s.description = <<-TEXT
|
@@ -25,12 +25,12 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
26
|
s.require_paths = ["lib"]
|
27
27
|
|
28
|
-
s.add_dependency 'rsolr', '>= 1.1.1', '<
|
28
|
+
s.add_dependency 'rsolr', '>= 1.1.1', '< 2.6'
|
29
29
|
s.add_dependency 'pr_geohash', '~>1.0'
|
30
|
-
|
31
|
-
s.add_development_dependency 'rake', '
|
30
|
+
s.add_dependency 'bigdecimal'
|
31
|
+
s.add_development_dependency 'rake', '~> 13.2'
|
32
32
|
s.add_development_dependency 'rspec', '~> 3.7'
|
33
|
-
s.add_development_dependency 'appraisal', '2.
|
33
|
+
s.add_development_dependency 'appraisal', '~> 2.5'
|
34
34
|
|
35
35
|
s.rdoc_options << '--webcvs=http://github.com/outoftime/sunspot/tree/master/%s' <<
|
36
36
|
'--title' << 'Sunspot - Solr-powered search for Ruby objects - API Documentation' <<
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -30,7 +30,7 @@ authors:
|
|
30
30
|
autorequire:
|
31
31
|
bindir: bin
|
32
32
|
cert_chain: []
|
33
|
-
date:
|
33
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rsolr
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version: 1.1.1
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
44
|
+
version: '2.6'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
version: 1.1.1
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pr_geohash
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +66,34 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bigdecimal
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '13.2'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '13.2'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +112,16 @@ dependencies:
|
|
98
112
|
name: appraisal
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
117
|
+
version: '2.5'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
124
|
+
version: '2.5'
|
111
125
|
description: |2
|
112
126
|
Sunspot is a library providing a powerful, all-ruby API for the Solr search engine. Sunspot manages the configuration of persistent
|
113
127
|
Ruby classes for search and indexing and exposes Solr's most powerful features through a collection of DSLs. Complex search operations
|
@@ -334,7 +348,7 @@ files:
|
|
334
348
|
- tasks/rdoc.rake
|
335
349
|
- tasks/schema.rake
|
336
350
|
- tasks/todo.rake
|
337
|
-
homepage:
|
351
|
+
homepage: https://sunspot.github.io
|
338
352
|
licenses:
|
339
353
|
- MIT
|
340
354
|
metadata: {}
|
@@ -358,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
358
372
|
- !ruby/object:Gem::Version
|
359
373
|
version: '0'
|
360
374
|
requirements: []
|
361
|
-
rubygems_version: 3.
|
375
|
+
rubygems_version: 3.4.19
|
362
376
|
signing_key:
|
363
377
|
specification_version: 4
|
364
378
|
summary: Library for expressive, powerful interaction with the Solr search engine
|