solr_wrapper 4.2.0 → 4.4.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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +9 -5
  3. data/README.md +8 -0
  4. data/lib/solr_wrapper/checksum_validator.rb +1 -1
  5. data/lib/solr_wrapper/client.rb +15 -5
  6. data/lib/solr_wrapper/configuration.rb +4 -3
  7. data/lib/solr_wrapper/downloader.rb +1 -1
  8. data/lib/solr_wrapper/instance.rb +21 -5
  9. data/lib/solr_wrapper/version.rb +1 -1
  10. data/solr_wrapper.gemspec +1 -2
  11. data/spec/fixtures/basic_configs_v10/schema.xml +402 -0
  12. data/spec/fixtures/basic_configs_v9/_rest_managed.json +1 -0
  13. data/spec/fixtures/basic_configs_v9/currency.xml +67 -0
  14. data/spec/fixtures/basic_configs_v9/lang/stopwords_en.txt +54 -0
  15. data/spec/fixtures/basic_configs_v9/protwords.txt +21 -0
  16. data/spec/fixtures/basic_configs_v9/solrconfig.xml +572 -0
  17. data/spec/fixtures/basic_configs_v9/stopwords.txt +14 -0
  18. data/spec/fixtures/basic_configs_v9/synonyms.txt +29 -0
  19. data/spec/lib/solr_wrapper/client_spec.rb +2 -0
  20. data/spec/lib/solr_wrapper/instance_spec.rb +18 -26
  21. data/spec/spec_helper.rb +0 -1
  22. metadata +38 -42
  23. /data/spec/fixtures/{basic_configs → basic_configs_v10}/_rest_managed.json +0 -0
  24. /data/spec/fixtures/{basic_configs → basic_configs_v10}/currency.xml +0 -0
  25. /data/spec/fixtures/{basic_configs → basic_configs_v10}/lang/stopwords_en.txt +0 -0
  26. /data/spec/fixtures/{basic_configs → basic_configs_v10}/protwords.txt +0 -0
  27. /data/spec/fixtures/{basic_configs → basic_configs_v10}/solrconfig.xml +0 -0
  28. /data/spec/fixtures/{basic_configs → basic_configs_v10}/stopwords.txt +0 -0
  29. /data/spec/fixtures/{basic_configs → basic_configs_v10}/synonyms.txt +0 -0
  30. /data/spec/fixtures/{basic_configs → basic_configs_v9}/schema.xml +0 -0
@@ -13,19 +13,23 @@ describe SolrWrapper::Instance do
13
13
  let(:options) { {} }
14
14
  let(:solr_instance) { SolrWrapper::Instance.new(options) }
15
15
  subject { solr_instance }
16
- let(:client) { SimpleSolrClient::Client.new(subject.url) }
16
+ let(:client) do
17
+ SolrWrapper::Client.new(subject.url)
18
+ end
19
+
20
+ let(:config_dir) do
21
+ version = solr_instance.config.version
22
+
23
+ version.start_with?(/1\d/) ? File.join(FIXTURES_DIR, 'basic_configs_v10') : File.join(FIXTURES_DIR, 'basic_configs_v9')
24
+ end
17
25
 
18
26
  describe "#with_collection" do
19
27
  let(:options) { { cloud: false } }
20
28
  context "without a name" do
21
29
  it "creates a new anonymous collection" do
22
30
  subject.wrap do |solr|
23
- solr.with_collection(dir: File.join(FIXTURES_DIR, "basic_configs")) do |collection_name|
24
- core = client.core(collection_name)
25
- unless defined? JRUBY_VERSION
26
- expect(core.schema.field('id').name).to eq 'id'
27
- expect(core.schema.field('id').stored).to eq true
28
- end
31
+ solr.with_collection(dir: config_dir) do |collection_name|
32
+ expect(client.exists?(collection_name)).to be true
29
33
  end
30
34
  end
31
35
  end
@@ -40,7 +44,7 @@ describe SolrWrapper::Instance do
40
44
  it "creates a new collection with options from the config" do
41
45
  expect(solr_instance).to receive(:create).with(
42
46
  hash_including(name: "project-development", dir: anything))
43
- solr_instance.with_collection(dir: File.join(FIXTURES_DIR, "basic_configs")) {}
47
+ solr_instance.with_collection(dir: config_dir) {}
44
48
  end
45
49
  end
46
50
 
@@ -55,11 +59,11 @@ describe SolrWrapper::Instance do
55
59
  describe 'single solr node' do
56
60
  it 'allows persistent collection on restart' do
57
61
  subject.wrap do |solr|
58
- solr.with_collection(name: 'solr-node-persistent-core', dir: File.join(FIXTURES_DIR, 'basic_configs'), persist: true) {}
62
+ solr.with_collection(name: 'solr-node-persistent-core', dir: config_dir, persist: true) {}
59
63
  end
60
64
 
61
65
  subject.wrap do |solr|
62
- solr.with_collection(name: 'solr-node-persistent-core', dir: File.join(FIXTURES_DIR, 'basic_configs'), persist: true) {}
66
+ solr.with_collection(name: 'solr-node-persistent-core', dir: config_dir, persist: true) {}
63
67
  solr.delete 'solr-node-persistent-core'
64
68
  end
65
69
  end
@@ -70,7 +74,7 @@ describe SolrWrapper::Instance do
70
74
 
71
75
  it 'allows persistent collection on restart' do
72
76
  subject.wrap do |solr|
73
- config_name = solr.upconfig dir: File.join(FIXTURES_DIR, 'basic_configs')
77
+ config_name = solr.upconfig dir: config_dir
74
78
  solr.with_collection(name: 'solr-cloud-persistent-collection', config_name: config_name, persist: true) {}
75
79
  end
76
80
 
@@ -87,16 +91,12 @@ describe SolrWrapper::Instance do
87
91
  let(:options) { { cloud: true } }
88
92
  it 'can upload configurations' do
89
93
  subject.wrap do |solr|
90
- config_name = solr.upconfig dir: File.join(FIXTURES_DIR, 'basic_configs')
94
+ config_name = solr.upconfig dir: config_dir
91
95
  Dir.mktmpdir do |dir|
92
96
  solr.downconfig name: config_name, dir: dir
93
97
  end
94
98
  solr.with_collection(config_name: config_name) do |collection_name|
95
- core_name = client.cores.select { |x| x =~ /^#{collection_name}/ }.first
96
- core = client.core(core_name)
97
- unless defined? JRUBY_VERSION
98
- expect(core.all.size).to eq 0
99
- end
99
+ client.exists? collection_name
100
100
  end
101
101
  end
102
102
  end
@@ -120,16 +120,8 @@ describe SolrWrapper::Instance do
120
120
 
121
121
  describe 'exec' do
122
122
  let(:cmd) { 'start' }
123
- let(:options) { { p: '4098', help: true } }
123
+ let(:options) { { p: '4098' } }
124
124
  subject { solr_instance.send(:exec, cmd, options) }
125
- it 'runs the command' do
126
- result_io = subject
127
- expect(result_io.read).to include('Usage: solr start')
128
- end
129
- it 'accepts boolean flags' do
130
- result_io = solr_instance.send(:exec, 'start', p: '4098', help: true)
131
- expect(result_io.read).to include('Usage: solr start')
132
- end
133
125
 
134
126
  describe 'when something goes wrong' do
135
127
  let(:cmd) { 'healthcheck' }
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'solr_wrapper'
2
- require 'simple_solr_client'
3
2
 
4
3
  require 'rspec'
5
4
  require 'webmock/rspec'
metadata CHANGED
@@ -1,34 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solr_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-08-04 00:00:00.000000000 Z
10
+ date: 2026-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '1.0'
19
- - - "<"
16
+ - - "~>"
20
17
  - !ruby/object:Gem::Version
21
- version: '3'
18
+ version: '2.0'
22
19
  type: :runtime
23
20
  prerelease: false
24
21
  version_requirements: !ruby/object:Gem::Requirement
25
22
  requirements:
26
- - - ">="
23
+ - - "~>"
27
24
  - !ruby/object:Gem::Version
28
- version: '1.0'
29
- - - "<"
30
- - !ruby/object:Gem::Version
31
- version: '3'
25
+ version: '2.0'
32
26
  - !ruby/object:Gem::Dependency
33
27
  name: faraday-follow_redirects
34
28
  requirement: !ruby/object:Gem::Requirement
@@ -153,20 +147,6 @@ dependencies:
153
147
  - - ">="
154
148
  - !ruby/object:Gem::Version
155
149
  version: '0'
156
- - !ruby/object:Gem::Dependency
157
- name: simple_solr_client
158
- requirement: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - '='
161
- - !ruby/object:Gem::Version
162
- version: 0.2.0
163
- type: :development
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - '='
168
- - !ruby/object:Gem::Version
169
- version: 0.2.0
170
150
  - !ruby/object:Gem::Dependency
171
151
  name: webmock
172
152
  requirement: !ruby/object:Gem::Requirement
@@ -215,14 +195,22 @@ files:
215
195
  - lib/solr_wrapper/version.rb
216
196
  - solr_wrapper.gemspec
217
197
  - spec/fixtures/another_sample_config.yml
218
- - spec/fixtures/basic_configs/_rest_managed.json
219
- - spec/fixtures/basic_configs/currency.xml
220
- - spec/fixtures/basic_configs/lang/stopwords_en.txt
221
- - spec/fixtures/basic_configs/protwords.txt
222
- - spec/fixtures/basic_configs/schema.xml
223
- - spec/fixtures/basic_configs/solrconfig.xml
224
- - spec/fixtures/basic_configs/stopwords.txt
225
- - spec/fixtures/basic_configs/synonyms.txt
198
+ - spec/fixtures/basic_configs_v10/_rest_managed.json
199
+ - spec/fixtures/basic_configs_v10/currency.xml
200
+ - spec/fixtures/basic_configs_v10/lang/stopwords_en.txt
201
+ - spec/fixtures/basic_configs_v10/protwords.txt
202
+ - spec/fixtures/basic_configs_v10/schema.xml
203
+ - spec/fixtures/basic_configs_v10/solrconfig.xml
204
+ - spec/fixtures/basic_configs_v10/stopwords.txt
205
+ - spec/fixtures/basic_configs_v10/synonyms.txt
206
+ - spec/fixtures/basic_configs_v9/_rest_managed.json
207
+ - spec/fixtures/basic_configs_v9/currency.xml
208
+ - spec/fixtures/basic_configs_v9/lang/stopwords_en.txt
209
+ - spec/fixtures/basic_configs_v9/protwords.txt
210
+ - spec/fixtures/basic_configs_v9/schema.xml
211
+ - spec/fixtures/basic_configs_v9/solrconfig.xml
212
+ - spec/fixtures/basic_configs_v9/stopwords.txt
213
+ - spec/fixtures/basic_configs_v9/synonyms.txt
226
214
  - spec/fixtures/sample_config.yml
227
215
  - spec/lib/solr_wrapper/client_spec.rb
228
216
  - spec/lib/solr_wrapper/configuration_spec.rb
@@ -252,14 +240,22 @@ specification_version: 4
252
240
  summary: Solr service wrapper
253
241
  test_files:
254
242
  - spec/fixtures/another_sample_config.yml
255
- - spec/fixtures/basic_configs/_rest_managed.json
256
- - spec/fixtures/basic_configs/currency.xml
257
- - spec/fixtures/basic_configs/lang/stopwords_en.txt
258
- - spec/fixtures/basic_configs/protwords.txt
259
- - spec/fixtures/basic_configs/schema.xml
260
- - spec/fixtures/basic_configs/solrconfig.xml
261
- - spec/fixtures/basic_configs/stopwords.txt
262
- - spec/fixtures/basic_configs/synonyms.txt
243
+ - spec/fixtures/basic_configs_v10/_rest_managed.json
244
+ - spec/fixtures/basic_configs_v10/currency.xml
245
+ - spec/fixtures/basic_configs_v10/lang/stopwords_en.txt
246
+ - spec/fixtures/basic_configs_v10/protwords.txt
247
+ - spec/fixtures/basic_configs_v10/schema.xml
248
+ - spec/fixtures/basic_configs_v10/solrconfig.xml
249
+ - spec/fixtures/basic_configs_v10/stopwords.txt
250
+ - spec/fixtures/basic_configs_v10/synonyms.txt
251
+ - spec/fixtures/basic_configs_v9/_rest_managed.json
252
+ - spec/fixtures/basic_configs_v9/currency.xml
253
+ - spec/fixtures/basic_configs_v9/lang/stopwords_en.txt
254
+ - spec/fixtures/basic_configs_v9/protwords.txt
255
+ - spec/fixtures/basic_configs_v9/schema.xml
256
+ - spec/fixtures/basic_configs_v9/solrconfig.xml
257
+ - spec/fixtures/basic_configs_v9/stopwords.txt
258
+ - spec/fixtures/basic_configs_v9/synonyms.txt
263
259
  - spec/fixtures/sample_config.yml
264
260
  - spec/lib/solr_wrapper/client_spec.rb
265
261
  - spec/lib/solr_wrapper/configuration_spec.rb