outoftime-sunspot 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -151,8 +151,9 @@ http://outoftime.lighthouseapp.com/projects/20339-sunspot
151
151
 
152
152
  == Contributors
153
153
 
154
- Mat Brown (mat@patch.com)
155
- Peer Allan
154
+ * Mat Brown (mat@patch.com)
155
+ * Peer Allan (peer.allan@gmail.com)
156
+ * Dmitriy Dzema (dima@dzema.name)
156
157
 
157
158
  == License
158
159
 
data/TODO CHANGED
@@ -6,6 +6,9 @@
6
6
  * Instantiated facets!
7
7
  * Direct access to adapter
8
8
  * sunspot-configure-solr
9
+ * Text fields allow multiple
10
+ * Don't allow ordering on multiple-allowed fields
11
+ * Transactions
9
12
  * Switch to RSolr
10
13
  * Facet by type (?)
11
14
  * Query-based faceting (?)
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 8
4
- :patch: 3
4
+ :patch: 4
@@ -117,11 +117,12 @@ module Sunspot
117
117
  #
118
118
  def for(clazz) #:nodoc:
119
119
  original_class_name = clazz.name
120
- while clazz != Object
121
- class_name = clazz.name.to_sym
120
+ clazz.ancestors.each do |ancestor_class|
121
+ next if ancestor_class.name.empty?
122
+ class_name = ancestor_class.name.to_sym
122
123
  return instance_adapters[class_name] if instance_adapters[class_name]
123
- clazz = clazz.superclass
124
124
  end
125
+
125
126
  raise(Sunspot::NoAdapterError,
126
127
  "No adapter is configured for #{original_class_name} or its superclasses. See the documentation for Sunspot::Adapters")
127
128
  end
@@ -229,10 +230,10 @@ module Sunspot
229
230
  # Class:: Implementation of DataAccessor, or nil if none found
230
231
  #
231
232
  def for(clazz) #:nodoc:
232
- while clazz != Object
233
- class_name = clazz.name.to_sym
233
+ clazz.ancestors.each do |ancestor_class|
234
+ next if ancestor_class.name.empty?
235
+ class_name = ancestor_class.name.to_sym
234
236
  return data_accessors[class_name] if data_accessors[class_name]
235
- clazz = clazz.superclass
236
237
  end
237
238
  end
238
239
 
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe Sunspot::Adapters::InstanceAdapter do
4
+ it "finds adapter by superclass" do
5
+ Sunspot::Adapters::InstanceAdapter::for(Model).should be(AbstractModelInstanceAdapter)
6
+ end
7
+
8
+ it "finds adapter by mixin" do
9
+ Sunspot::Adapters::InstanceAdapter::for(MixModel).should be(MixInModelInstanceAdapter)
10
+ end
11
+ end
12
+
13
+ describe Sunspot::Adapters::DataAccessor do
14
+ it "finds adapter by superclass" do
15
+ Sunspot::Adapters::DataAccessor::for(Model).should be(AbstractModelDataAccessor)
16
+ end
17
+
18
+ it "finds adapter by mixin" do
19
+ Sunspot::Adapters::DataAccessor::for(MixModel).should be(MixInModelDataAccessor)
20
+ end
21
+ end
@@ -0,0 +1,32 @@
1
+ class AbstractModel
2
+ end
3
+
4
+ class Model < AbstractModel
5
+ end
6
+
7
+ class AbstractModelInstanceAdapter < Sunspot::Adapters::InstanceAdapter
8
+ end
9
+
10
+ class AbstractModelDataAccessor < Sunspot::Adapters::DataAccessor
11
+ end
12
+
13
+ Sunspot::Adapters::InstanceAdapter.register(AbstractModelInstanceAdapter, AbstractModel)
14
+ Sunspot::Adapters::DataAccessor.register(AbstractModelDataAccessor, AbstractModel)
15
+
16
+
17
+ module MixInModel
18
+ end
19
+
20
+ class MixModel
21
+ include MixInModel
22
+ end
23
+
24
+ class MixInModelInstanceAdapter < Sunspot::Adapters::InstanceAdapter
25
+ end
26
+
27
+ class MixInModelDataAccessor < Sunspot::Adapters::DataAccessor
28
+ end
29
+
30
+ Sunspot::Adapters::InstanceAdapter.register(MixInModelInstanceAdapter, MixInModel)
31
+ Sunspot::Adapters::DataAccessor.register(MixInModelDataAccessor, MixInModel)
32
+
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.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-03 00:00:00 -07:00
12
+ date: 2009-06-09 00:00:00 -07:00
13
13
  default_executable: sunspot-solr
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -100,6 +100,7 @@ files:
100
100
  - solr/solr/conf/synonyms.txt
101
101
  - solr/start.jar
102
102
  - solr/webapps/solr.war
103
+ - spec/api/adapters_spec.rb
103
104
  - spec/api/build_search_spec.rb
104
105
  - spec/api/indexer_spec.rb
105
106
  - spec/api/query_spec.rb
@@ -112,6 +113,7 @@ files:
112
113
  - spec/integration/scoped_search_spec.rb
113
114
  - spec/integration/spec_helper.rb
114
115
  - spec/integration/test_pagination.rb
116
+ - spec/mocks/adapters.rb
115
117
  - spec/mocks/base_class.rb
116
118
  - spec/mocks/comment.rb
117
119
  - spec/mocks/mock_adapter.rb
@@ -163,6 +165,7 @@ test_files:
163
165
  - spec/integration/dynamic_fields_spec.rb
164
166
  - spec/integration/test_pagination.rb
165
167
  - spec/mocks/base_class.rb
168
+ - spec/mocks/adapters.rb
166
169
  - spec/mocks/mock_adapter.rb
167
170
  - spec/mocks/user.rb
168
171
  - spec/mocks/post.rb
@@ -170,6 +173,7 @@ test_files:
170
173
  - spec/api/search_retrieval_spec.rb
171
174
  - spec/api/spec_helper.rb
172
175
  - spec/api/session_spec.rb
176
+ - spec/api/adapters_spec.rb
173
177
  - spec/api/build_search_spec.rb
174
178
  - spec/api/indexer_spec.rb
175
179
  - spec/api/query_spec.rb