sunspot 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c13ef43c3d9e3c45ca9d1ccc170ba55947797e788911fda1982b817d34207c5d
4
- data.tar.gz: 8a2dc3da8797d0ff4945c99732c9808e1ff9d06f94d0611b932a20cc49210d08
3
+ metadata.gz: 06d94f7de37bd42e2766b04b245a4529620124558e275e7f6a0aca6b905978ab
4
+ data.tar.gz: 1966e3348ed17403862dc3d677225e2da0da85d62b6d1071f1c7ad7d9a3c423c
5
5
  SHA512:
6
- metadata.gz: dbdf307d46210db9f3430a7a46d615709aa181c61c2400f6e42d23edd5dfa0c619ecb249cf148eb7215d4dd37d9907c630acf4d13ec83319cff1cbdd2652882e
7
- data.tar.gz: f77be8b5ee7ea9226565214951f4af0930b994f9fe568b4c79ac7d0733d414644d32018b4bdfb0ebd23a19b30ecece2c45da5d29b8bd46e28aafaf33ff58796f
6
+ metadata.gz: 93134646633877883e4b3ea6b6f8308f4c40d2806daf78a249816bf92dddf7ca80c0f06e48a12a5e85c84665e26fb0666d181a5b71ba8c88462ccd2a6160479e
7
+ data.tar.gz: c31692b2cb14e5cae05ecc294f5d9ce7fb761d9712ad838a78f037eb3a107c03d05c13e6ef2f52055d32047a0fd9679ea044ac16156cf90c1464e510a3ee3fb0
@@ -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
- read_timeout: config.solr.read_timeout,
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 __proxy_method__(method, *args, &block)
297
- begin
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
- rescue ::NoMethodError => e
300
- begin
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
- rescue ::NoMethodError
303
- raise(e)
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
@@ -1,3 +1,3 @@
1
1
  module Sunspot
2
- VERSION = '2.6.0'
2
+ VERSION = '2.7.0'
3
3
  end
@@ -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.new('40.7'), BigDecimal.new('-73.5'))
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.new('40.7'), BigDecimal.new('-73.5'))
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
- {:status => status.to_s}
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
@@ -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[:read_timeout]).to eq(0.5)
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
@@ -17,5 +17,5 @@ Sunspot.setup(Namespaced::Comment) do
17
17
  long :hash
18
18
  double :average_rating
19
19
  dynamic_float :custom_float, :multiple => true
20
- boost :boost
20
+ boost(:boost)
21
21
  end
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 = "http://outoftime.github.com/sunspot"
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', '< 3'
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', '< 12.3'
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.2.0'
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.6.0
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: 2022-05-30 00:00:00.000000000 Z
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: '3'
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: '3'
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: '12.3'
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: '12.3'
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.2.0
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.2.0
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: http://outoftime.github.com/sunspot
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.1.4
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