solr4r 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: ad8418aa9f1a84f5ff0c9196c7f1a805b8b4e84d
4
- data.tar.gz: 4b557a50a64366aa9501f436dc0c2f1d66a5412e
3
+ metadata.gz: 1eb013ec51b5992887da6af277a1759141707b52
4
+ data.tar.gz: 3b73d27e55827c539e7a562521bab48d319e5c6b
5
5
  SHA512:
6
- metadata.gz: b1f608e0dac485d86383efca1f68b099d08e803d57b3371d61cdbfa7de93166207d745ff7068af226086f8ce8d35bbcc8eeb1ae946c31c32f7c0d22707029a3d
7
- data.tar.gz: e75af57456ae37f54c70ebd448010b07b9055ea853dcd530521315267c958bad360e52db7bc55e9cee777099712849f3033bee15922a3a257650e4a1e47de187
6
+ metadata.gz: 2ba2a373cbbe0de467babbc4efcada292cc26d7a0c1ff944fb174399d9c325c74075f596974b239a54f4b2c2c3a8d18226a5d071ef76f6436527fafd6da8d62f
7
+ data.tar.gz: 13b4e84b371c320b29856e576d9c5a9bcf61ac45eb372d5012b0f686c7ea7d5c5767a5c32201afcd8e90c38a38b0654ed2f8c3af3dcf5a65dbfeef7981ea5123
data/ChangeLog CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  = Revision history for solr4r
4
4
 
5
+ == 0.0.7 [2015-08-14]
6
+
7
+ * Fixed Solr4R::Client::Query#json_query for multiple +fq+ parameters.
8
+ * Renamed Solr4R::Response#extend_hash to Solr4R::Response#result_object.
9
+ * Renamed Solr4R::Client::Update#delete_by_id to
10
+ Solr4R::Client::Update#delete_id.
11
+ * Renamed Solr4R::Client::Update#delete_by_query to
12
+ Solr4R::Client::Update#delete_query.
13
+ * Renamed Solr4R::Client::Update#delete_all! to
14
+ Solr4R::Client::Update#delete_all.
15
+ * Added alias Solr4R::Client::Update#clear for
16
+ Solr4R::Client::Update#delete_all.
17
+ * Added Solr4R::Client#escape.
18
+ * Added Solr4R::Client#query_string.
19
+ * Added Solr4R::Client#local_params_string.
20
+ * Updated Solr4R::Client::Query#more_like_this_q for Solr 5.3.0.
21
+ * Fixes handling of multiple field names
22
+ (SOLR-7143[https://issues.apache.org/jira/browse/SOLR-7143]).
23
+ * Adds support for other MoreLikeThisHandler options
24
+ (SOLR-7639[https://issues.apache.org/jira/browse/SOLR-7639]).
25
+ * Refactored Solr4R::Endpoints#initialize to accept options hash.
26
+ * Refactored Solr4R::Builder#delete to use Solr4R::Client#query_string for
27
+ query hashes.
28
+
5
29
  == 0.0.6 [2015-03-18]
6
30
 
7
31
  * Extracted Solr4R::Endpoints from Solr4R::Client.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to solr4r version 0.0.6
5
+ This documentation refers to solr4r version 0.0.7
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/Rakefile CHANGED
@@ -13,7 +13,10 @@ begin
13
13
  email: %q{jens.wille@gmail.com},
14
14
  license: %q{AGPL-3.0},
15
15
  homepage: :blackwinter,
16
- dependencies: { nokogiri: '~> 1.6', 'nuggets' => ['~> 1.0', '>= 1.0.1'] },
16
+
17
+ dependencies: { nokogiri: '~> 1.6', 'nuggets' => '~> 1.3' },
18
+
19
+ development_dependencies: { vcr: '~> 2.9', webmock: '~> 1.21' },
17
20
 
18
21
  required_ruby_version: '>= 1.9.3'
19
22
  }
@@ -41,16 +41,22 @@ module Solr4R
41
41
 
42
42
  DEFAULT_OPTIONS = { encoding: 'UTF-8' }
43
43
 
44
- def initialize(options = {})
44
+ ILLEGAL_CHAR_RE = /[\x00-\x08\x0B\x0C\x0E-\x1F]/
45
+
46
+ def initialize(client, options = client.options)
45
47
  raise ArgumentError,
46
48
  'block argument not supported, use options hash instead' if block_given?
47
49
 
50
+ @client = client
51
+
48
52
  super(
49
- @_solr_opt = DEFAULT_OPTIONS.merge(options),
50
- @_solr_doc = Document.new
53
+ @solr4r_opt = DEFAULT_OPTIONS.merge(options),
54
+ @solr4r_doc = Document.new
51
55
  )
52
56
  end
53
57
 
58
+ attr_reader :client
59
+
54
60
  # See Schema[http://wiki.apache.org/solr/UpdateXmlMessages#add.2Freplace_documents].
55
61
  #
56
62
  # Examples:
@@ -112,7 +118,7 @@ module Solr4R
112
118
  # <add>
113
119
  # <doc>
114
120
  # <field name="id">42</field>
115
- # <field boost="2.0" name="text">blah</field>
121
+ # <field name="text" boost="2.0">blah</field>
116
122
  # </doc>
117
123
  # </add>
118
124
  #
@@ -123,14 +129,17 @@ module Solr4R
123
129
  # <add commitWithin="23">
124
130
  # <doc boost="10.0">
125
131
  # <field name="id">42</field>
126
- # <field boost="2.0" name="text">blah</field>
132
+ # <field name="text" boost="2.0">blah</field>
127
133
  # </doc>
128
134
  # </add>
129
135
  def add(doc, attributes = {})
130
136
  to_xml(:add, attributes) { |add_node| _each(doc) { |hash, doc_attributes|
131
137
  add_node.doc_(doc_attributes) { |doc_node| hash.each { |key, values|
132
- field_attributes = (values.is_a?(Array) && values.last.is_a?(Hash) ?
133
- (values = values.dup).pop : {}).merge(name: key)
138
+ field_attributes = { name: key }
139
+
140
+ if values.is_a?(Array) && values.last.is_a?(Hash)
141
+ field_attributes.update((values = values.dup).pop)
142
+ end
134
143
 
135
144
  _each(values) { |value| doc_node.field_(value, field_attributes) }
136
145
  } }
@@ -261,31 +270,28 @@ module Solr4R
261
270
  def delete(hash)
262
271
  to_xml(:delete) { |delete_node| hash.each { |key, values|
263
272
  case key.to_s
264
- when 'id'
265
- _each(values) { |id| delete_node.id_(id) }
266
- when 'query'
267
- _each(values) { |query|
268
- delete_node.query_(Client.query_string(query, false)) }
269
- else
270
- raise ArgumentError, "`id' or `query' expected, got %p" % key
273
+ when 'id' then _each(values) { |value| delete_node.id_(value) }
274
+ when 'query' then _each(values) { |value| delete_node.query_(
275
+ client.query_string(value, false)) }
276
+ else raise ArgumentError, "`id' or `query' expected, got %p" % key
271
277
  end
272
278
  } }
273
279
  end
274
280
 
275
281
  def inspect
276
- '#<%s:0x%x %p>' % [self.class, object_id, @_solr_opt]
282
+ '#<%s:0x%x %p>' % [self.class, object_id, @solr4r_opt]
277
283
  end
278
284
 
279
285
  private
280
286
 
281
287
  def to_xml(name, attributes = {}, &block)
282
- self.parent = self.doc = @_solr_doc.dup
288
+ self.parent = self.doc = @solr4r_doc.dup
283
289
  method_missing(name, attributes, &block)
284
290
  replace_illegal_characters(super(&nil))
285
291
  end
286
292
 
287
293
  def replace_illegal_characters(string)
288
- string.gsub(/[\x00-\x08\x0B\x0C\x0E-\x1F]/, '')
294
+ string.gsub(ILLEGAL_CHAR_RE, '')
289
295
  end
290
296
 
291
297
  def _each(values, &block)
data/lib/solr4r/client.rb CHANGED
@@ -23,12 +23,18 @@
23
23
  ###############################################################################
24
24
  #++
25
25
 
26
+ require 'forwardable'
27
+
26
28
  module Solr4R
27
29
 
28
30
  class Client
29
31
 
30
32
  include Logging
31
33
 
34
+ extend Forwardable
35
+
36
+ DEFAULT_URI = 'http://%s:%d/%s/%s'
37
+
32
38
  DEFAULT_HOST = 'localhost'
33
39
  DEFAULT_PORT = 8983
34
40
  DEFAULT_PATH = 'solr'
@@ -39,7 +45,7 @@ module Solr4R
39
45
  class << self
40
46
 
41
47
  def default_uri(options = {})
42
- 'http://%s:%d/%s/%s' % [
48
+ DEFAULT_URI % [
43
49
  options.fetch(:host, DEFAULT_HOST),
44
50
  options.fetch(:port, DEFAULT_PORT),
45
51
  options.fetch(:path, DEFAULT_PATH),
@@ -68,7 +74,7 @@ module Solr4R
68
74
  end
69
75
 
70
76
  def local_params_string(local_params, hash = {}, escape = true)
71
- case local_params = expand_local_params(local_params, hash)
77
+ case local_params = expand_local_params(local_params, hash.dup)
72
78
  when nil
73
79
  # ignore
74
80
  when String
@@ -106,7 +112,7 @@ module Solr4R
106
112
  when nil
107
113
  local_params
108
114
  when String, Symbol
109
- type_error(local_params, :Array) unless local_params.is_a?(Array)
115
+ type_error(local_params, Array) unless local_params.is_a?(Array)
110
116
 
111
117
  local_params.each { |param| hash[param] = "$#{type}.#{param}" }
112
118
  hash
@@ -130,18 +136,22 @@ module Solr4R
130
136
 
131
137
  self.logger = options.fetch(:logger) { default_logger }
132
138
 
133
- self.builder = options.fetch(:builder) { forward_logger(Builder.new) }
139
+ self.builder = options.fetch(:builder) { forward_logger(
140
+ Builder.new(self)) }
134
141
 
135
- self.request = options.fetch(:request) { forward_logger(Request.new(
136
- self, uri || options.fetch(:uri) { default_uri })) }
142
+ self.request = options.fetch(:request) { forward_logger(
143
+ Request.new(self, uri || options.fetch(:uri) { default_uri })) }
137
144
 
138
- self.endpoints = forward_logger(Endpoints.new(self))
145
+ self.endpoints = forward_logger(
146
+ Endpoints.new(self))
139
147
  end
140
148
 
141
149
  attr_accessor :options, :builder, :request, :default_params, :endpoints
142
150
 
143
151
  alias_method :ep, :endpoints
144
152
 
153
+ def_delegators 'self.class', :query_string, :local_params_string, :escape
154
+
145
155
  def json(path,
146
156
  params = {}, options = {}, &block)
147
157
 
@@ -186,7 +196,7 @@ module Solr4R
186
196
  end
187
197
 
188
198
  def amend_options_array(options, key, *value)
189
- options.merge(key => Array(options[key]).dup.concat(value))
199
+ options.merge(key => Array(options[key]) + value)
190
200
  end
191
201
 
192
202
  def send_request(path, options, &block)
@@ -64,6 +64,7 @@ module Solr4R
64
64
  params = {}, options = {}, path = DEFAULT_ANALYZE_DOCUMENT_PATH, &block)
65
65
 
66
66
  doc = builder.doc(doc) unless doc.is_a?(String)
67
+
67
68
  update(doc, amend_options_hash(
68
69
  options, :params, wt: :json), path, &block).result % 'analysis'
69
70
  end
@@ -34,8 +34,15 @@ module Solr4R
34
34
 
35
35
  MLT_DEFAULT_FL = '*,score'
36
36
  MLT_DEFAULT_ROWS = 5
37
- MLT_LOCAL_PARAMS = local_params_string(
38
- %w[mintf mindf minwl maxwl], type: :mlt, qf: '$mlt.fl')
37
+ MLT_LOCAL_PARAMS = local_params_string(%w[
38
+ maxdf
39
+ maxntp
40
+ maxqt
41
+ maxwl
42
+ mindf
43
+ mintf
44
+ minwl
45
+ ], type: :mlt, qf: '$mlt.fl')
39
46
 
40
47
  module Query
41
48
 
@@ -44,14 +51,15 @@ module Solr4R
44
51
 
45
52
  params = params.merge(rows: 0)
46
53
  params[:q] ||= MATCH_ALL_QUERY
54
+
47
55
  get(path, params, options, &block)
48
56
  end
49
57
 
50
58
  def json_query(
51
59
  params = {}, options = {}, path = DEFAULT_SELECT_PATH, &block)
52
60
 
53
- json(path, params.merge(Hash[[:q, :fq].map { |key|
54
- [key, self.class.query_string(params[key])] }]), options, &block)
61
+ json(path, params.merge(q: query_string(params[:q]), fq: Array(
62
+ params[:fq]).map(&method(:query_string))), options, &block)
55
63
  end
56
64
 
57
65
  def json_document(id,
@@ -63,14 +71,20 @@ module Solr4R
63
71
  def more_like_this_h(id, fields,
64
72
  params = {}, options = {}, path = DEFAULT_MLT_PATH, &block)
65
73
 
66
- _more_like_this_query({ id: id }, fields, params, options, path, &block)
74
+ _more_like_this_query({ id: id },
75
+ fields, params, options, path, &block)
67
76
  end
68
77
 
69
78
  def more_like_this_q(id, fields,
70
79
  params = {}, options = {}, path = DEFAULT_SELECT_PATH, &block)
71
80
 
72
- _more_like_this_query(MLT_LOCAL_PARAMS + id, fields, amend_options_array(
73
- params, :fq, '-id' => id, _: { cache: false }), options, path, &block)
81
+ # Drop after Solr 5.4.0 has been released?
82
+ # https://issues.apache.org/jira/browse/SOLR-7912
83
+ params = amend_options_array(
84
+ params, :fq, '-id' => id, _: { cache: false })
85
+
86
+ _more_like_this_query(MLT_LOCAL_PARAMS + id,
87
+ fields, params, options, path, &block)
74
88
  end
75
89
 
76
90
  alias_method :more_like_this, :more_like_this_q
@@ -94,26 +94,28 @@ module Solr4R
94
94
  end
95
95
 
96
96
  # See #delete.
97
- def delete_by_id(id,
97
+ def delete_id(id,
98
98
  params = {}, options = {}, &block)
99
99
 
100
100
  delete({ id: id }, params, options, &block)
101
101
  end
102
102
 
103
103
  # See #delete.
104
- def delete_by_query(query,
104
+ def delete_query(query,
105
105
  params = {}, options = {}, &block)
106
106
 
107
107
  delete({ query: query }, params, options, &block)
108
108
  end
109
109
 
110
- # See #delete_by_query.
111
- def delete_all!(
110
+ # See #delete_query.
111
+ def delete_all(
112
112
  params = {}, options = {}, &block)
113
113
 
114
- delete_by_query(MATCH_ALL_QUERY, params, options, &block)
114
+ delete_query(MATCH_ALL_QUERY, params, options, &block)
115
115
  end
116
116
 
117
+ alias_method :clear, :delete_all
118
+
117
119
  end
118
120
 
119
121
  include Update
@@ -31,9 +31,9 @@ module Solr4R
31
31
 
32
32
  DEFAULT_ENDPOINTS = %w[select query export spell suggest terms debug/dump]
33
33
 
34
- def initialize(client)
34
+ def initialize(client, options = client.options)
35
35
  @client, @endpoints = client, []
36
- register(client.options.fetch(:endpoints, DEFAULT_ENDPOINTS))
36
+ register(options.fetch(:endpoints, DEFAULT_ENDPOINTS))
37
37
  end
38
38
 
39
39
  attr_reader :client
@@ -59,18 +59,18 @@ module Solr4R
59
59
  when Array
60
60
  path.each { |args| register(*args) }
61
61
  when Hash
62
- path.each { |name, opts| register(name,
63
- opts.is_a?(Hash) ? opts : { path: opts }) }
62
+ path.each { |_path, _options| register(_path,
63
+ _options.is_a?(Hash) ? _options : { path: _options }) }
64
64
  else
65
- Client.send(:type_error, path, %w[String Symbol Array Hash])
65
+ client.class.send(:type_error, path, %w[String Symbol Array Hash])
66
66
  end
67
67
 
68
68
  self
69
69
  end
70
70
 
71
71
  def inspect
72
- '#<%s:0x%x [%s]>' % [self.class, object_id, @endpoints.map { |name, path|
73
- name == path ? name : "#{name}=#{path}" }.join(', ')]
72
+ '#<%s:0x%x [%s]>' % [self.class, object_id,
73
+ @endpoints.map { |ep| ep.uniq.join('=') }.join(', ')]
74
74
  end
75
75
 
76
76
  private
@@ -35,7 +35,7 @@ module Solr4R
35
35
  DEFAULT_CHARSET = 'UTF-8'
36
36
 
37
37
  def initialize(request, req = nil, res = nil)
38
- @request, @evaluate = request, req.response_body_permitted?
38
+ @request, @evaluate = request, req && req.response_body_permitted?
39
39
 
40
40
  if req
41
41
  self.request_body = req.body
@@ -93,8 +93,8 @@ module Solr4R
93
93
  def evaluate_result
94
94
  case wt = request_params[:wt]
95
95
  when String then to_s
96
- when :ruby then extend_hash(eval(to_s))
97
- when :json then extend_hash(JSON.parse(to_s))
96
+ when :ruby then result_object(eval(to_s))
97
+ when :json then result_object(JSON.parse(to_s))
98
98
  else raise 'The response cannot be evaluated: wt=%p not supported.' % wt
99
99
  end
100
100
  end
@@ -113,7 +113,7 @@ module Solr4R
113
113
  Integer(result[Regexp.new(pattern % [name, '(\d+)']), 1])
114
114
  end
115
115
 
116
- def extend_hash(object)
116
+ def result_object(object)
117
117
  object.is_a?(Hash) ? Result.new(self, object) : object
118
118
  end
119
119
 
@@ -55,8 +55,7 @@ module Solr4R
55
55
 
56
56
  def query_pairs(key, value, pairs = [])
57
57
  if value.is_a?(Hash)
58
- kv = value.fetch(vk = :_, true)
59
- pairs << [key, kv] unless kv.nil?
58
+ kv = value.fetch(vk = :_, true) and pairs << [key, kv]
60
59
 
61
60
  value.each { |sub, val|
62
61
  query_pairs("#{key}.#{sub}", val, pairs) unless sub == vk }
@@ -4,7 +4,7 @@ module Solr4R
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 6
7
+ TINY = 7
8
8
 
9
9
  class << self
10
10
 
@@ -1,5 +1,7 @@
1
1
  describe Solr4R::Builder do
2
2
 
3
+ subject { described_class.new(Solr4R::Client.new) }
4
+
3
5
  describe '#add' do
4
6
 
5
7
  example do
@@ -62,7 +64,7 @@ describe Solr4R::Builder do
62
64
  <add>
63
65
  <doc>
64
66
  <field name="id">42</field>
65
- <field boost="2.0" name="text">blah</field>
67
+ <field name="text" boost="2.0">blah</field>
66
68
  </doc>
67
69
  </add>
68
70
  EOT
@@ -74,7 +76,7 @@ describe Solr4R::Builder do
74
76
  <add commitWithin="23">
75
77
  <doc boost="10.0">
76
78
  <field name="id">42</field>
77
- <field boost="2.0" name="text">blah</field>
79
+ <field name="text" boost="2.0">blah</field>
78
80
  </doc>
79
81
  </add>
80
82
  EOT
@@ -90,4 +90,102 @@ describe Solr4R::Client do
90
90
 
91
91
  end
92
92
 
93
+ describe 'requests', vcr: true do
94
+
95
+ describe '#get' do
96
+
97
+ def get(*args)
98
+ res = subject.get(*args)
99
+
100
+ expect(res).to be_success
101
+ expect(res.response_code).to eq(200)
102
+
103
+ res
104
+ end
105
+
106
+ it "should get /select" do
107
+ res = get('select')
108
+
109
+ expect(res.to_i).to eq(0)
110
+ expect(res.to_s).to be_a(String)
111
+ expect(res.result).to be_a(Solr4R::Result)
112
+ end
113
+
114
+ it "should get /select JSON result" do
115
+ res = get('select', wt: :json)
116
+
117
+ expect(res.to_i).to eq(0)
118
+ expect(res.to_s).to be_a(String)
119
+ expect(res.result).to be_a(Solr4R::Result)
120
+ end
121
+
122
+ it "should get /select JSON string" do
123
+ res = get('select', wt: 'json')
124
+
125
+ expect(res.to_i).to eq(0)
126
+ expect(res.to_s).to be_a(String)
127
+ expect(res.result).to be_a(String)
128
+ end
129
+
130
+ it "should get /select XML" do
131
+ res = get('select', wt: 'xml')
132
+
133
+ expect(res.to_i).to eq(0)
134
+ expect(res.to_s).to be_a(String)
135
+ expect(res.result).to be_a(String)
136
+ end
137
+
138
+ it "should get /select CSV" do
139
+ res, err = get('select', wt: :csv), /:csv not supported/
140
+
141
+ expect { res.to_i }.to raise_error(err)
142
+ expect(res.to_s).to be_a(String)
143
+ expect { res.result }.to raise_error(err)
144
+ end
145
+
146
+ it "should get /select FOO" do
147
+ res, err = get('select', wt: 'foo'), /"foo" not supported/
148
+
149
+ expect { res.to_i }.to raise_error(err)
150
+ expect(res.to_s).to be_a(String)
151
+ expect(res.result).to be_a(String)
152
+ end
153
+
154
+ it "should not get /foo" do
155
+ res = subject.get('foo')
156
+
157
+ expect(res).not_to be_success
158
+ expect(res.response_code).to eq(404)
159
+ end
160
+
161
+ end
162
+
163
+ describe '#json' do
164
+
165
+ def expect_json(*args)
166
+ res = subject.json('select', *args)
167
+
168
+ expect(res).to be_a(Solr4R::Result)
169
+ expect(res).to be_a(Solr4R::Result::Response)
170
+ expect(res.to_i).to eq(0)
171
+ expect(res).to be_empty
172
+ expect(res).not_to be_error
173
+ end
174
+
175
+ it "should get /select JSON" do
176
+ expect_json
177
+ end
178
+
179
+ it "should get /select JSON with wt symbol override" do
180
+ expect_json(wt: 'foo')
181
+ end
182
+
183
+ it "should get /select JSON with wt string override" do
184
+ expect_json('wt' => 'foo')
185
+ end
186
+
187
+ end
188
+
189
+ end
190
+
93
191
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,12 @@
1
1
  $:.unshift('lib') unless $:.first == 'lib'
2
2
 
3
3
  require 'solr4r'
4
+ require 'vcr'
5
+
6
+ VCR.configure { |config|
7
+ config.hook_into :webmock
8
+ config.configure_rspec_metadata!
9
+ config.cassette_library_dir = 'spec/vcr_cassettes'
10
+ }
11
+
12
+ WebMock::Config.instance.query_values_notation = :flat_array
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":1,"params":{"wt":"json"}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=csv
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: 'address_s,cat,weight,_version_,store,manufacturedate_dt,price_c,includes,incubationdate_dt,id,price,manu,name,features,payloads,manu_id_s,compName_s,inStock,popularity
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/xml; charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: |
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <response>
32
+ <lst name="responseHeader"><int name="status">0</int><int name="QTime">0</int><lst name="params"><str name="wt">foo</str></lst></lst><result name="response" numFound="0" start="0"></result>
33
+ </response>
34
+ http_version:
35
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
36
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":0,"params":{"wt":"json"}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":0,"params":{"wt":"json"}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=xml
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/xml; charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: |
30
+ <?xml version="1.0" encoding="UTF-8"?>
31
+ <response>
32
+ <lst name="responseHeader"><int name="status">0</int><int name="QTime">0</int><lst name="params"><str name="wt">xml</str></lst></lst><result name="response" numFound="0" start="0"></result>
33
+ </response>
34
+ http_version:
35
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
36
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/foo?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: Not Found
22
+ headers:
23
+ Content-Type:
24
+ - text/html;charset=ISO-8859-1
25
+ Cache-Control:
26
+ - must-revalidate,no-cache,no-store
27
+ Content-Length:
28
+ - '1385'
29
+ body:
30
+ encoding: UTF-8
31
+ string: "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;
32
+ charset=ISO-8859-1\"/>\n<title>Error 404 Not Found</title>\n</head>\n<body><h2>HTTP
33
+ ERROR 404</h2>\n<p>Problem accessing /solr/collection1/foo. Reason:\n<pre>
34
+ \ Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
35
+ \ \n<br/> \n<br/>
36
+ \ \n<br/> \n<br/>
37
+ \ \n<br/> \n<br/>
38
+ \ \n<br/> \n<br/>
39
+ \ \n<br/> \n<br/>
40
+ \ \n<br/> \n<br/>
41
+ \ \n<br/> \n<br/>
42
+ \ \n<br/> \n<br/>
43
+ \ \n<br/> \n<br/>
44
+ \ \n<br/> \n\n</body>\n</html>\n"
45
+ http_version:
46
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
47
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":0,"params":{"wt":"json"}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=foo&wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":0,"params":{"wt":["json","foo"]}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,34 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:8983/solr/collection1/select?wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Solr4R/0.0.6
16
+ Host:
17
+ - localhost:8983
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - text/plain;charset=UTF-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ body:
28
+ encoding: UTF-8
29
+ string: '{"responseHeader":{"status":0,"QTime":1,"params":{"wt":"json"}},"response":{"numFound":0,"start":0,"docs":[]}}
30
+
31
+ '
32
+ http_version:
33
+ recorded_at: Thu, 19 Mar 2015 13:51:32 GMT
34
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solr4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -30,20 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 1.0.1
33
+ version: '1.3'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '1.0'
44
- - - ">="
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.21'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
45
67
  - !ruby/object:Gem::Version
46
- version: 1.0.1
68
+ version: '1.21'
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: hen
49
71
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +75,7 @@ dependencies:
53
75
  version: '0.8'
54
76
  - - ">="
55
77
  - !ruby/object:Gem::Version
56
- version: 0.8.1
78
+ version: 0.8.3
57
79
  type: :development
58
80
  prerelease: false
59
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +85,7 @@ dependencies:
63
85
  version: '0.8'
64
86
  - - ">="
65
87
  - !ruby/object:Gem::Version
66
- version: 0.8.1
88
+ version: 0.8.3
67
89
  - !ruby/object:Gem::Dependency
68
90
  name: rake
69
91
  requirement: !ruby/object:Gem::Requirement
@@ -123,45 +145,49 @@ files:
123
145
  - spec/solr4r/builder_spec.rb
124
146
  - spec/solr4r/client_spec.rb
125
147
  - spec/spec_helper.rb
148
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select.yml
149
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select_CSV.yml
150
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select_FOO.yml
151
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select_JSON_result.yml
152
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select_JSON_string.yml
153
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_get_/select_XML.yml
154
+ - spec/vcr_cassettes/Solr4R_Client/requests/_get/should_not_get_/foo.yml
155
+ - spec/vcr_cassettes/Solr4R_Client/requests/_json/should_get_/select_JSON.yml
156
+ - spec/vcr_cassettes/Solr4R_Client/requests/_json/should_get_/select_JSON_with_wt_string_override.yml
157
+ - spec/vcr_cassettes/Solr4R_Client/requests/_json/should_get_/select_JSON_with_wt_symbol_override.yml
126
158
  homepage: http://github.com/blackwinter/solr4r
127
159
  licenses:
128
160
  - AGPL-3.0
129
161
  metadata: {}
130
162
  post_install_message: |2+
131
163
 
132
- solr4r-0.0.6 [2015-03-18]:
164
+ solr4r-0.0.7 [2015-08-14]:
133
165
 
134
- * Extracted Solr4R::Endpoints from Solr4R::Client.
135
- * Extracted Solr4R::Client::Admin, Solr4R::Client::Query and
136
- Solr4R::Client::Update from Solr4R::Client.
137
- * Added core to Solr4R::Client.default_uri and adjusted
138
- Solr4R::Client::DEFAULT_SYSTEM_PATH.
139
- * Added Solr4R::Client::Admin#cores.
140
- * Added Solr4R::Client::Admin#fields.
141
- * Added Solr4R::Client::Admin#analyze_document.
142
- * Added Solr4R::Client::Admin#analyze_field.
143
- * Added Solr4R::Client::Query#json_document.
144
- * Added Solr4R::Client::Query#more_like_this_h (using the {request
145
- handler}[https://cwiki.apache.org/confluence/display/solr/MoreLikeThis]).
146
- * Added Solr4R::Client::Query#more_like_this_q (using the {query
147
- parser}[https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-MoreLikeThisQueryParser]).
148
- * Added support for {local
149
- params}[https://cwiki.apache.org/confluence/display/solr/Local+Parameters+in+Queries]
150
- to Solr4R::Client.query_string.
151
- * Extended Solr4R::RequestUriExtension#query_pairs to skip +nil+ values.
152
- * Extended Solr4R::RequestUriExtension#query_pairs to allow control over
153
- nested key's value (via +:_+).
154
- * Refactored Solr4R::Document#more_like_this to use
155
- Solr4R::Client#more_like_this.
156
- * Refactored Solr4R::Builder#delete to use Solr4R::Client.query_string for
166
+ * Fixed Solr4R::Client::Query#json_query for multiple +fq+ parameters.
167
+ * Renamed Solr4R::Response#extend_hash to Solr4R::Response#result_object.
168
+ * Renamed Solr4R::Client::Update#delete_by_id to
169
+ Solr4R::Client::Update#delete_id.
170
+ * Renamed Solr4R::Client::Update#delete_by_query to
171
+ Solr4R::Client::Update#delete_query.
172
+ * Renamed Solr4R::Client::Update#delete_all! to
173
+ Solr4R::Client::Update#delete_all.
174
+ * Added alias Solr4R::Client::Update#clear for
175
+ Solr4R::Client::Update#delete_all.
176
+ * Added Solr4R::Client#escape.
177
+ * Added Solr4R::Client#query_string.
178
+ * Added Solr4R::Client#local_params_string.
179
+ * Updated Solr4R::Client::Query#more_like_this_q for Solr 5.3.0.
180
+ * Fixes handling of multiple field names
181
+ (SOLR-7143[https://issues.apache.org/jira/browse/SOLR-7143]).
182
+ * Adds support for other MoreLikeThisHandler options
183
+ (SOLR-7639[https://issues.apache.org/jira/browse/SOLR-7639]).
184
+ * Refactored Solr4R::Endpoints#initialize to accept options hash.
185
+ * Refactored Solr4R::Builder#delete to use Solr4R::Client#query_string for
157
186
  query hashes.
158
- * Refactored Solr4R::Request preparation; dropped
159
- Solr4R::HTTPRequestExtension.
160
- * Refactored Solr4R::Response initialization.
161
187
 
162
188
  rdoc_options:
163
189
  - "--title"
164
- - solr4r Application documentation (v0.0.6)
190
+ - solr4r Application documentation (v0.0.7)
165
191
  - "--charset"
166
192
  - UTF-8
167
193
  - "--line-numbers"
@@ -182,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
208
  version: '0'
183
209
  requirements: []
184
210
  rubyforge_project:
185
- rubygems_version: 2.4.6
211
+ rubygems_version: 2.4.8
186
212
  signing_key:
187
213
  specification_version: 4
188
214
  summary: A Ruby client for Apache Solr.