logstash-output-custom-solr 0.1.12 → 0.1.13

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: 35e80fb9396d28e256f3711566b0d8bb729cada2b9a32e4f9069476dda97cc3a
4
- data.tar.gz: 728a130b779fa8dd3f231bb7139d353deb9fb9ed445d18838d6d1872d2432f67
3
+ metadata.gz: bb4053e38740dc0fe90a2087dc117a65da30a594efa1c62ef4ac3b704212fd3f
4
+ data.tar.gz: 89fe6f0255d7d0dd5dc0b0487a82da3b0000a9bfb6a53c8956948ffee9a096d4
5
5
  SHA512:
6
- metadata.gz: a40b070243792827c1be3b05bba43cf5a4a00cfbd59d692cce49ab284457565a5cb01967bc5e66918afda25ac64f90ce6c1c723c4de71994a2b34c49d86d0394
7
- data.tar.gz: cd838abdf107ce39f7b93363113b4dc3bfaaae2a00ef57da3ce53b72c7defdcb7a76ab5b3cf414d63a08ff744b7552a4b9806033fd73c061a46f92a98c8422d7
6
+ metadata.gz: '09fa19c7d95edcb8deb887b08f72c96804687f16ca25404a6c763b7dacc1c8be1bccf1f30f1f98053103944c04ff00a840287730afd18a66a2920600a048a305'
7
+ data.tar.gz: 34ce09678366e8a75c1e72cbc614b85a8bb758e259ac8b8d9acc1aecdf794f501a5c7454f407f0a15a8adc75d02a6df862def9f080c7bdff6f92a76e8fb2ea8f
@@ -94,13 +94,16 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
94
94
  end
95
95
 
96
96
  @logger.info 'Record: %s' % document.inspect
97
+
98
+ collection = @collection
97
99
 
100
+ @logger.info 'collection_field: %s' % @collection_field
101
+ @logger.info 'has_key?: %s' % document.has_key?(@collection_field).to_s
98
102
  if @collection_field and document.has_key?(@collection_field) then
99
103
  collection = document[@collection_field]
100
104
  document.delete(@collection_field)
101
- else
102
- collection = @collection
103
105
  end
106
+ @logger.info 'Collection: %s' % collection
104
107
 
105
108
  documents = documents_per_col.fetch(collection, [])
106
109
  documents.push(document)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-custom-solr'
3
- s.version = "0.1.12"
3
+ s.version = "0.1.13"
4
4
  s.licenses = ["Apache License (2.0)"]
5
5
  s.summary = "Logstash output plugin for sending data to Solr."
6
6
  s.description = "Logstash output plugin for sending data to Solr. It supports SolrCloud, not only Standalone Solr."
@@ -154,6 +154,52 @@ describe LogStash::Outputs::Solr do
154
154
  end
155
155
  end
156
156
 
157
+ describe 'multiple_collections' do
158
+ before do
159
+ start_zookeeper
160
+ end
161
+
162
+ after do
163
+ stop_zookeeper
164
+ end
165
+
166
+ let(:config) {
167
+ {
168
+ 'zk_host' => 'localhost:3292/solr',
169
+ 'collection_field' => 'collection',
170
+ 'flush_size' => 100
171
+ }
172
+ }
173
+
174
+ let(:sample_record1) {
175
+ {
176
+ 'id' => 'test1',
177
+ 'collection' => 'col1'
178
+ }
179
+ }
180
+ let(:sample_record2) {
181
+ {
182
+ 'id' => 'test2',
183
+ 'collection' => 'col2'
184
+ }
185
+ }
186
+ let(:sample_record3) {
187
+ {
188
+ 'id' => 'test3'
189
+ }
190
+ }
191
+
192
+ it 'receive' do
193
+ output = LogStash::Outputs::Solr.new(config)
194
+ output.register
195
+
196
+ output.receive(sample_record1)
197
+ output.receive(sample_record2)
198
+ output.receive(sample_record3)
199
+ output.flush([sample_record1, sample_record2, sample_record3])
200
+ end
201
+ end
202
+
157
203
  def start_zookeeper
158
204
  @zk_server = ZK::Server.new do |config|
159
205
  config.client_port = 3292
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-custom-solr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minoru Osuka