thinking-sphinx 1.3.10 → 1.3.11

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.10
1
+ 1.3.11
@@ -0,0 +1,10 @@
1
+ Feature: Abstract inheritance
2
+ In order to use Thinking Sphinx in complex situations
3
+ As a developer
4
+ I want to define indexes on subclasses of abstract models
5
+
6
+ Scenario: Searching on subclasses of abstract models
7
+ Given Sphinx is running
8
+ And I am searching on music
9
+ When I search
10
+ Then I should get 3 results
@@ -0,0 +1,4 @@
1
+ pop = Genre.create(:name => "Pop")
2
+ Music.create :artist => "Gotye", :album => "Like Drawing Blood", :track => "Heart's A Mess", :genre => pop
3
+ Music.create :artist => "The Whitlams", :album => "Eternal Nightcap", :track => "Melbourne", :genre => pop
4
+ Music.create :artist => "Ben Folds", :album => "Ben Folds Live", :track => "Not The Same", :genre => pop
@@ -0,0 +1,3 @@
1
+ ActiveRecord::Base.connection.create_table :genres, :force => true do |t|
2
+ t.column :name, :string
3
+ end
@@ -0,0 +1,6 @@
1
+ ActiveRecord::Base.connection.create_table :music, :force => true do |t|
2
+ t.column :artist, :string
3
+ t.column :album, :string
4
+ t.column :track, :string
5
+ t.column :genre_id, :integer
6
+ end
@@ -0,0 +1,3 @@
1
+ class Genre < ActiveRecord::Base
2
+ #
3
+ end
@@ -0,0 +1,5 @@
1
+ class Medium < ActiveRecord::Base
2
+ self.abstract_class = true
3
+
4
+ belongs_to :genre
5
+ end
@@ -0,0 +1,8 @@
1
+ class Music < Medium
2
+ set_table_name 'music'
3
+
4
+ define_index do
5
+ indexes artist, track, album
6
+ indexes genre(:name), :as => :genre
7
+ end
8
+ end
@@ -164,6 +164,8 @@ module ThinkingSphinx
164
164
  end
165
165
 
166
166
  def define_indexes
167
+ superclass.define_indexes unless superclass == ::ActiveRecord::Base
168
+
167
169
  return if sphinx_index_blocks.nil? ||
168
170
  defined_indexes? ||
169
171
  !ThinkingSphinx.define_indexes?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thinking-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-10 00:00:00 +11:00
12
+ date: 2009-12-12 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -129,6 +129,7 @@ signing_key:
129
129
  specification_version: 3
130
130
  summary: ActiveRecord/Rails Sphinx library
131
131
  test_files:
132
+ - features/abstract_inheritance.feature
132
133
  - features/alternate_primary_key.feature
133
134
  - features/attribute_transformation.feature
134
135
  - features/attribute_updates.feature
@@ -171,6 +172,7 @@ test_files:
171
172
  - features/support/db/fixtures/extensible_betas.rb
172
173
  - features/support/db/fixtures/foxes.rb
173
174
  - features/support/db/fixtures/gammas.rb
175
+ - features/support/db/fixtures/music.rb
174
176
  - features/support/db/fixtures/people.rb
175
177
  - features/support/db/fixtures/posts.rb
176
178
  - features/support/db/fixtures/robots.rb
@@ -186,6 +188,8 @@ test_files:
186
188
  - features/support/db/migrations/create_developers.rb
187
189
  - features/support/db/migrations/create_extensible_betas.rb
188
190
  - features/support/db/migrations/create_gammas.rb
191
+ - features/support/db/migrations/create_genres.rb
192
+ - features/support/db/migrations/create_music.rb
189
193
  - features/support/db/migrations/create_people.rb
190
194
  - features/support/db/migrations/create_posts.rb
191
195
  - features/support/db/migrations/create_robots.rb
@@ -206,6 +210,9 @@ test_files:
206
210
  - features/support/models/extensible_beta.rb
207
211
  - features/support/models/fox.rb
208
212
  - features/support/models/gamma.rb
213
+ - features/support/models/genre.rb
214
+ - features/support/models/medium.rb
215
+ - features/support/models/music.rb
209
216
  - features/support/models/person.rb
210
217
  - features/support/models/post.rb
211
218
  - features/support/models/robot.rb