sunspot 0.10.1 → 0.10.2
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.
- data/History.txt +6 -0
- data/VERSION.yml +1 -1
- data/lib/sunspot/configuration.rb +7 -0
- data/lib/sunspot/session.rb +9 -1
- data/spec/api/session_spec.rb +6 -0
- data/spec/mocks/connection.rb +2 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.10.2 2009-10-09
|
2
|
+
* Add Sunspot.config.xml_builder option, which is passed to RSolr
|
3
|
+
|
4
|
+
== 0.10.1 2009-10-08
|
5
|
+
* Fix directory bugs in sunspot-solr executable
|
6
|
+
|
1
7
|
== 0.10.0 2009-10-08
|
2
8
|
* Support for geographical search using LocalSolr
|
3
9
|
* Support for keyword highlighting, with custom deferred formatting
|
data/VERSION.yml
CHANGED
@@ -7,6 +7,11 @@ module Sunspot
|
|
7
7
|
# :net_http, which is the default and uses Ruby's built-in pure-Ruby HTTP
|
8
8
|
# library; and :curb, which uses Ruby's libcurl bindings and requires
|
9
9
|
# installation of the 'curb' gem.
|
10
|
+
# Sunspot.config.xml_builder::
|
11
|
+
# The library use to build XML messages sent to Solr. As of this writing the
|
12
|
+
# options are :builder and :libxml - the latter is faster but less portable,
|
13
|
+
# as it is native code. Check the documentation for RSolr::Message::Adapter
|
14
|
+
# for more information.
|
10
15
|
# Sunspot.config.solr.url::
|
11
16
|
# The URL at which to connect to Solr
|
12
17
|
# (default: 'http://localhost:8983/solr')
|
@@ -25,6 +30,8 @@ module Sunspot
|
|
25
30
|
def build #:nodoc:
|
26
31
|
LightConfig.build do
|
27
32
|
http_client :net_http
|
33
|
+
xml_builder :builder
|
34
|
+
|
28
35
|
solr do
|
29
36
|
url 'http://127.0.0.1:8983/solr'
|
30
37
|
end
|
data/lib/sunspot/session.rb
CHANGED
@@ -188,7 +188,15 @@ module Sunspot
|
|
188
188
|
def connection
|
189
189
|
@connection ||=
|
190
190
|
begin
|
191
|
-
self.class.connection_class.connect(
|
191
|
+
connection = self.class.connection_class.connect(
|
192
|
+
:url => config.solr.url,
|
193
|
+
:adapter => config.http_client
|
194
|
+
)
|
195
|
+
connection.message.adapter =
|
196
|
+
RSolr::Message::Adapter.const_get(
|
197
|
+
Util.camel_case(config.xml_builder.to_s)
|
198
|
+
).new
|
199
|
+
connection
|
192
200
|
end
|
193
201
|
end
|
194
202
|
|
data/spec/api/session_spec.rb
CHANGED
@@ -86,6 +86,12 @@ describe 'Session' do
|
|
86
86
|
Sunspot.commit
|
87
87
|
connection.adapter.should == :curb
|
88
88
|
end
|
89
|
+
|
90
|
+
it 'should use LibXML builder when specified' do
|
91
|
+
Sunspot.config.xml_builder = :libxml
|
92
|
+
Sunspot.commit
|
93
|
+
connection.message.adapter.should be_a(RSolr::Message::Adapter::Libxml)
|
94
|
+
end
|
89
95
|
end
|
90
96
|
|
91
97
|
context 'custom session' do
|
data/spec/mocks/connection.rb
CHANGED
@@ -22,11 +22,12 @@ module Mock
|
|
22
22
|
end
|
23
23
|
|
24
24
|
class Connection
|
25
|
-
attr_reader :adds, :commits, :searches
|
25
|
+
attr_reader :adds, :commits, :searches, :message
|
26
26
|
attr_accessor :adapter, :opts
|
27
27
|
|
28
28
|
def initialize(adapter = nil, opts = nil)
|
29
29
|
@adapter, @opts = adapter, opts
|
30
|
+
@message = OpenStruct.new
|
30
31
|
@adds, @deletes, @deletes_by_query, @commits, @searches = Array.new(5) { [] }
|
31
32
|
end
|
32
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2009-10-
|
20
|
+
date: 2009-10-09 00:00:00 -04:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|