delsolr 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -166,8 +166,7 @@ module DelSolr
166
166
  end
167
167
 
168
168
  if body.blank? # cache miss (or wasn't enabled)
169
- header, body = connection.get(configuration.path + query_builder.request_string)
170
-
169
+ header, body = connection.post("#{configuration.path}/select", query_builder.request_string)
171
170
  # We get UTF-8 from Solr back, make sure the string knows about it
172
171
  # when running on Ruby >= 1.9
173
172
  if body.respond_to?(:force_encoding)
@@ -188,7 +187,7 @@ module DelSolr
188
187
  if response && response.success?
189
188
  response_stat_string = "#{from_cache ? cache_time : response.qtime},#{response.total},"
190
189
  end
191
- logger.info "#{from_cache ? 'C' : 'S'},#{response_stat_string}http://#{configuration.full_path}#{response.request_url}"
190
+ logger.info "#{from_cache ? 'C' : 'S'},#{response_stat_string}http://#{configuration.full_path}/select?#{response.request_url}"
192
191
  end
193
192
  response
194
193
  # If we error, just return nil and let the client decide what to do
@@ -105,7 +105,7 @@ module DelSolr
105
105
  end
106
106
  end
107
107
 
108
- "/select?#{param_strings.join('&')}"
108
+ param_strings.join('&')
109
109
  end
110
110
 
111
111
  # returns the query param
@@ -183,7 +183,7 @@ class ClientTest < Test::Unit::TestCase
183
183
  mock_query_builder = DelSolr::Client::QueryBuilder
184
184
  mock_query_builder.stubs(:request_string).returns('/select?some_query') # mock the query builder
185
185
  DelSolr::Client::QueryBuilder.stubs(:new).returns(mock_query_builder)
186
- c.connection.expects(:get).raises(StandardError) # mock the connection
186
+ c.connection.expects(:post).raises(StandardError) # mock the connection
187
187
  assert_nothing_raised do
188
188
  r = c.query('standard', :query => '123')
189
189
  assert_nil(r)
@@ -196,7 +196,7 @@ class ClientTest < Test::Unit::TestCase
196
196
  mock_query_builder = DelSolr::Client::QueryBuilder
197
197
  mock_query_builder.stubs(:request_string).returns('/select?some_query') # mock the query builder
198
198
  DelSolr::Client::QueryBuilder.stubs(:new).returns(mock_query_builder)
199
- c.connection.expects(:get).with("/abcsolr" + mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
199
+ c.connection.expects(:post).with("/abcsolr/select", mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
200
200
  r = c.query('standard', :query => '123')
201
201
  assert(r)
202
202
  assert_equal([1,3,4,5,7,8,9,10,11,12], r.ids.sort)
@@ -209,7 +209,7 @@ class ClientTest < Test::Unit::TestCase
209
209
  mock_query_builder = DelSolr::Client::QueryBuilder
210
210
  mock_query_builder.stubs(:request_string).returns('/select?some_query') # mock the query builder
211
211
  DelSolr::Client::QueryBuilder.stubs(:new).returns(mock_query_builder)
212
- c.connection.expects(:get).with("/solr" + mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
212
+ c.connection.expects(:post).with("/solr/select", mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
213
213
  r = c.query('standard', :query => '123')
214
214
  assert(r)
215
215
  assert_equal([1,3,4,5,7,8,9,10,11,12], r.ids.sort)
@@ -223,7 +223,7 @@ class ClientTest < Test::Unit::TestCase
223
223
  mock_query_builder = DelSolr::Client::QueryBuilder
224
224
  mock_query_builder.stubs(:request_string).returns('/select?some_query') # mock the query builder
225
225
  DelSolr::Client::QueryBuilder.stubs(:new).returns(mock_query_builder)
226
- c.connection.expects(:get).with("/solr" + mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
226
+ c.connection.expects(:post).with("/solr/select", mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
227
227
  r = c.query('standard', :query => '123', :enable_caching => true)
228
228
  assert(r)
229
229
  assert_equal([1,3,4,5,7,8,9,10,11,12], r.ids.sort)
@@ -242,7 +242,7 @@ class ClientTest < Test::Unit::TestCase
242
242
  mock_query_builder = DelSolr::Client::QueryBuilder
243
243
  mock_query_builder.stubs(:request_string).returns('/select?some_query') # mock the query builder
244
244
  DelSolr::Client::QueryBuilder.stubs(:new).returns(mock_query_builder)
245
- c.connection.expects(:get).with("/solr" + mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
245
+ c.connection.expects(:post).with("/solr/select", mock_query_builder.request_string).returns([nil, @@response_buffer]) # mock the connection
246
246
  r = c.query('standard', :query => '123')
247
247
  assert(r)
248
248
 
@@ -162,8 +162,7 @@ private
162
162
 
163
163
  # given a url returns a hash of the query params (for each duplicate key, it returns an array)
164
164
  def get_params(url)
165
- query = URI.parse(url).query
166
- query = query.split('&')
165
+ query = url.split('&')
167
166
  h = {}
168
167
  query.each do |p|
169
168
  a = p.split('=')
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delsolr
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
4
+ prerelease:
5
+ version: 0.1.5
10
6
  platform: ruby
11
7
  authors:
12
8
  - Ben VandenBos
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 9
31
- - 0
32
24
  version: 0.9.0
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -67,21 +59,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
59
  requirements:
68
60
  - - ">="
69
61
  - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
62
  version: "0"
73
63
  required_rubygems_version: !ruby/object:Gem::Requirement
74
64
  none: false
75
65
  requirements:
76
66
  - - ">="
77
67
  - !ruby/object:Gem::Version
78
- segments:
79
- - 0
80
68
  version: "0"
81
69
  requirements: []
82
70
 
83
71
  rubyforge_project:
84
- rubygems_version: 1.3.7
72
+ rubygems_version: 1.5.0
85
73
  signing_key:
86
74
  specification_version: 3
87
75
  summary: DelSolr is a light weight ruby wrapper for solr. It's intention is to expose the full power of solr queries while keeping the interface as ruby-esque as possible.