onemorecloud-websolr-rails 1.4.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 1.4.2
2
+ - Made connection errors a unique exception.
1
3
  1.4.1
2
4
  - Changed start to local:start, stop to local:stop
3
5
  - Removed dependency on remote environment
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.1
1
+ 1.4.3
data/lib/acts_as_solr.rb CHANGED
@@ -32,7 +32,9 @@ require File.dirname(__FILE__) + '/deprecation'
32
32
  require File.dirname(__FILE__) + '/search_results'
33
33
  require File.dirname(__FILE__) + '/lazy_document'
34
34
  require File.dirname(__FILE__) + '/will_paginate_support'
35
+
35
36
  module ActsAsSolr
37
+ class ConnectionError < RuntimeError; end
36
38
 
37
39
  class Post
38
40
  def self.execute(request)
@@ -51,7 +53,7 @@ module ActsAsSolr
51
53
  connection = Solr::Connection.new(url)
52
54
  return connection.send(request)
53
55
  rescue
54
- raise "Couldn't connect to the Solr server at #{url}. #{$!}"
56
+ raise ActsAsSolr::ConnectionError, "Couldn't connect to the Solr server at #{url}. #{$!}"
55
57
  false
56
58
  end
57
59
  end
data/lib/class_methods.rb CHANGED
@@ -116,6 +116,10 @@ module ActsAsSolr #:nodoc:
116
116
  return parse_results(data, options) if data
117
117
  end
118
118
 
119
+ def all_multi_solr_search(query, options = {})
120
+ parse_query(query, options, "")
121
+ end
122
+
119
123
  # Finds instances of a model and returns an array with the ids:
120
124
  # Book.find_id_by_solr "rails" => [1,4,7]
121
125
  # The options accepted are the same as find_by_solr
@@ -16,6 +16,8 @@ require 'net/http'
16
16
 
17
17
  class Solr::Connection
18
18
  attr_reader :url, :autocommit, :connection
19
+
20
+ ILLEGAL_XML_CHARS = /[\x00-\x1F]/
19
21
 
20
22
  # create a connection to a solr instance using the url for the solr
21
23
  # application context:
@@ -155,6 +157,15 @@ class Solr::Connection
155
157
  # send the http post request to solr; for convenience there are shortcuts
156
158
  # to some requests: add(), query(), commit(), delete() or send()
157
159
  def post(request)
160
+ if ENV["DEBUG"]
161
+ puts "POST #{@url.path + "/" + request.handler}"
162
+ puts "-- DATA -------------------"
163
+ puts request.to_s
164
+ puts "-- END DATA ---------------"
165
+ end
166
+
167
+ request = request.gsub(ILLEGAL_XML_CHARS, '')
168
+
158
169
  response = @connection.post(@url.path + "/" + request.handler,
159
170
  request.to_s,
160
171
  { "Content-Type" => request.content_type })
@@ -4,12 +4,12 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{websolr-rails}
8
- s.version = "1.4.1"
7
+ s.name = %q{onemorecloud-websolr-rails}
8
+ s.version = "1.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kyle Maxwell"]
12
- s.date = %q{2009-09-15}
12
+ s.date = %q{2009-10-10}
13
13
  s.default_executable = %q{websolr}
14
14
  s.description = %q{acts_as_solr compatible gem for websolr}
15
15
  s.email = %q{kyle@kylemaxwell.com}
@@ -190,7 +190,7 @@ Gem::Specification.new do |s|
190
190
  s.homepage = %q{http://github.com/onemorecloud/websolr-rails}
191
191
  s.rdoc_options = ["--main", "README.rdoc", "README.rdoc", "lib"]
192
192
  s.require_paths = ["lib"]
193
- s.rubygems_version = %q{1.3.5}
193
+ s.rubygems_version = %q{1.3.4}
194
194
  s.summary = %q{acts_as_solr compatible gem for websolr}
195
195
  s.test_files = [
196
196
  "test/db/connections/mysql/connection.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onemorecloud-websolr-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Maxwell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-15 00:00:00 -07:00
12
+ date: 2009-10-10 00:00:00 -07:00
13
13
  default_executable: websolr
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -199,9 +199,10 @@ files:
199
199
  - test/unit/solr_instance.rb
200
200
  - test/unit/test_helper.rb
201
201
  - websolr-rails.gemspec
202
- has_rdoc: false
202
+ has_rdoc: true
203
203
  homepage: http://github.com/onemorecloud/websolr-rails
204
- licenses:
204
+ licenses: []
205
+
205
206
  post_install_message:
206
207
  rdoc_options:
207
208
  - --main
@@ -225,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
226
  requirements: []
226
227
 
227
228
  rubyforge_project:
228
- rubygems_version: 1.3.5
229
+ rubygems_version: 1.3.4
229
230
  signing_key:
230
231
  specification_version: 3
231
232
  summary: acts_as_solr compatible gem for websolr