outoftime-sunspot 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/sunspot/query/field_facet.rb +1 -2
- data/lib/sunspot/session.rb +7 -6
- data/spec/api/build_search_spec.rb +0 -22
- data/spec/api/session_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +6 -0
- data/spec/mocks/connection.rb +8 -0
- data/tasks/gemspec.rake +1 -1
- metadata +24 -23
data/VERSION.yml
CHANGED
@@ -88,8 +88,7 @@ module Sunspot
|
|
88
88
|
:"facet.date" => [@field.indexed_name],
|
89
89
|
param_key('date.start') => start_time.utc.xmlschema,
|
90
90
|
param_key('date.end') => end_time.utc.xmlschema,
|
91
|
-
param_key('date.gap') => "+#{interval}SECONDS"
|
92
|
-
param_key('date.other') => others
|
91
|
+
param_key('date.gap') => "+#{interval}SECONDS"
|
93
92
|
)
|
94
93
|
end
|
95
94
|
|
data/lib/sunspot/session.rb
CHANGED
@@ -15,7 +15,7 @@ module Sunspot
|
|
15
15
|
# For testing purposes
|
16
16
|
#
|
17
17
|
def connection_class #:nodoc:
|
18
|
-
@connection_class ||= RSolr
|
18
|
+
@connection_class ||= RSolr
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -186,11 +186,12 @@ module Sunspot
|
|
186
186
|
def connection
|
187
187
|
@connection ||=
|
188
188
|
begin
|
189
|
-
|
190
|
-
|
191
|
-
)
|
192
|
-
|
193
|
-
connection
|
189
|
+
self.class.connection_class.connect(:url => config.solr.url, :adapter => config.http_client)
|
190
|
+
# connection = self.class.connection_class.new(
|
191
|
+
# RSolr::Adapter::HTTP.new(:url => config.solr.url)
|
192
|
+
# )
|
193
|
+
# connection.adapter.connector.adapter_name = config.http_client
|
194
|
+
# connection
|
194
195
|
end
|
195
196
|
end
|
196
197
|
|
@@ -708,28 +708,6 @@ describe 'Search' do
|
|
708
708
|
connection.should have_last_search_with(:"f.published_at_d.facet.date.gap" => "+3600SECONDS")
|
709
709
|
end
|
710
710
|
|
711
|
-
it 'should allow computation of one other time' do
|
712
|
-
session.search Post do |query|
|
713
|
-
query.facet :published_at, :time_range => @time_range, :time_other => :before
|
714
|
-
end
|
715
|
-
connection.should have_last_search_with(:"f.published_at_d.facet.date.other" => %w(before))
|
716
|
-
end
|
717
|
-
|
718
|
-
it 'should allow computation of two other times' do
|
719
|
-
session.search Post do |query|
|
720
|
-
query.facet :published_at, :time_range => @time_range, :time_other => [:before, :after]
|
721
|
-
end
|
722
|
-
connection.should have_last_search_with(:"f.published_at_d.facet.date.other" => %w(before after))
|
723
|
-
end
|
724
|
-
|
725
|
-
it 'should not allow computation of bogus other time' do
|
726
|
-
lambda do
|
727
|
-
session.search Post do |query|
|
728
|
-
query.facet :published_at, :time_range => @time_range, :time_other => :bogus
|
729
|
-
end
|
730
|
-
end.should raise_error(ArgumentError)
|
731
|
-
end
|
732
|
-
|
733
711
|
it 'should not allow date faceting on a non-date field' do
|
734
712
|
lambda do
|
735
713
|
session.search Post do |query|
|
data/spec/api/session_spec.rb
CHANGED
@@ -67,24 +67,24 @@ describe 'Session' do
|
|
67
67
|
|
68
68
|
it 'should open connection with defaults if nothing specified' do
|
69
69
|
Sunspot.commit
|
70
|
-
connection.
|
70
|
+
connection.opts[:url].should == 'http://127.0.0.1:8983/solr'
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should open a connection with custom host' do
|
74
74
|
Sunspot.config.solr.url = 'http://127.0.0.1:8981/solr'
|
75
75
|
Sunspot.commit
|
76
|
-
connection.
|
76
|
+
connection.opts[:url].should == 'http://127.0.0.1:8981/solr'
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'should use Net::HTTP adapter by default' do
|
80
80
|
Sunspot.commit
|
81
|
-
connection.adapter.
|
81
|
+
connection.adapter.should == :net_http
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should use Net::HTTP adapter when specified' do
|
85
85
|
Sunspot.config.http_client = :curb
|
86
86
|
Sunspot.commit
|
87
|
-
connection.adapter.
|
87
|
+
connection.adapter.should == :curb
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -100,7 +100,7 @@ describe 'Session' do
|
|
100
100
|
config.solr.url = 'http://127.0.0.1:8982/solr'
|
101
101
|
end
|
102
102
|
session.commit
|
103
|
-
connection.
|
103
|
+
connection.opts[:url].should == 'http://127.0.0.1:8982/solr'
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
data/spec/mocks/connection.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
module Mock
|
2
2
|
class ConnectionFactory
|
3
|
+
def connect(opts)
|
4
|
+
if @instance
|
5
|
+
raise('Factory can only create an instance once!')
|
6
|
+
else
|
7
|
+
@instance = Connection.new(opts.delete(:adapter), opts)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
3
11
|
def new(adapter = nil, opts = nil)
|
4
12
|
if @instance
|
5
13
|
raise('Factory can only create an instance once!')
|
data/tasks/gemspec.rake
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
s.description = 'Library for expressive, powerful interaction with the Solr search engine'
|
10
10
|
s.authors = ['Mat Brown', 'Peer Allan', 'Dmitriy Dzema', 'Benjamin Krause']
|
11
11
|
s.files = FileList['[A-Z]*', '{bin,lib,spec,tasks,templates}/**/*', 'solr/{etc,lib,webapps}/**/*', 'solr/solr/conf/*', 'solr/start.jar']
|
12
|
-
s.add_dependency 'mwmitchell-rsolr', '
|
12
|
+
s.add_dependency 'mwmitchell-rsolr', '= 0.9.6'
|
13
13
|
s.add_dependency 'daemons', '~> 1.0'
|
14
14
|
s.add_dependency 'optiflag', '~> 0.6.5'
|
15
15
|
s.add_dependency 'haml', '~> 2.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outoftime-sunspot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Brown
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-
|
15
|
+
date: 2009-09-13 00:00:00 -07:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -21,9 +21,9 @@ dependencies:
|
|
21
21
|
version_requirement:
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.9.6
|
27
27
|
version:
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: daemons
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- templates/schema.xml.haml
|
188
188
|
has_rdoc: true
|
189
189
|
homepage: http://github.com/outoftime/sunspot
|
190
|
+
licenses:
|
190
191
|
post_install_message:
|
191
192
|
rdoc_options:
|
192
193
|
- --charset=UTF-8
|
@@ -212,33 +213,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
213
|
requirements: []
|
213
214
|
|
214
215
|
rubyforge_project:
|
215
|
-
rubygems_version: 1.
|
216
|
+
rubygems_version: 1.3.5
|
216
217
|
signing_key:
|
217
|
-
specification_version:
|
218
|
+
specification_version: 2
|
218
219
|
summary: Library for expressive, powerful interaction with the Solr search engine
|
219
220
|
test_files:
|
220
|
-
- spec/
|
221
|
-
- spec/
|
221
|
+
- spec/api/adapters_spec.rb
|
222
|
+
- spec/api/build_search_spec.rb
|
223
|
+
- spec/api/indexer_spec.rb
|
224
|
+
- spec/api/query_spec.rb
|
225
|
+
- spec/api/search_retrieval_spec.rb
|
226
|
+
- spec/api/session_spec.rb
|
227
|
+
- spec/api/spec_helper.rb
|
228
|
+
- spec/api/sunspot_spec.rb
|
229
|
+
- spec/integration/dynamic_fields_spec.rb
|
222
230
|
- spec/integration/faceting_spec.rb
|
223
|
-
- spec/integration/scoped_search_spec.rb
|
224
231
|
- spec/integration/keyword_search_spec.rb
|
225
|
-
- spec/integration/
|
232
|
+
- spec/integration/scoped_search_spec.rb
|
233
|
+
- spec/integration/spec_helper.rb
|
226
234
|
- spec/integration/stored_fields_spec.rb
|
227
235
|
- spec/integration/test_pagination.rb
|
228
|
-
- spec/mocks/mock_record.rb
|
229
|
-
- spec/mocks/blog.rb
|
230
236
|
- spec/mocks/adapters.rb
|
237
|
+
- spec/mocks/blog.rb
|
238
|
+
- spec/mocks/comment.rb
|
239
|
+
- spec/mocks/connection.rb
|
231
240
|
- spec/mocks/mock_adapter.rb
|
232
|
-
- spec/mocks/
|
241
|
+
- spec/mocks/mock_record.rb
|
233
242
|
- spec/mocks/photo.rb
|
234
243
|
- spec/mocks/post.rb
|
235
|
-
- spec/mocks/
|
236
|
-
- spec/
|
237
|
-
- spec/api/search_retrieval_spec.rb
|
238
|
-
- spec/api/spec_helper.rb
|
239
|
-
- spec/api/session_spec.rb
|
240
|
-
- spec/api/adapters_spec.rb
|
241
|
-
- spec/api/build_search_spec.rb
|
242
|
-
- spec/api/sunspot_spec.rb
|
243
|
-
- spec/api/indexer_spec.rb
|
244
|
-
- spec/api/query_spec.rb
|
244
|
+
- spec/mocks/user.rb
|
245
|
+
- spec/spec_helper.rb
|