Created
October 17, 2009 16:52
-
-
Save tobstarr/212400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product < ActiveRecord::Base | |
define_index do | |
indexes :name | |
end | |
end | |
class Album < Product | |
end | |
class SonyAlbum < Album | |
end | |
Product.create!(:name => "Product") | |
Album.create!(:name => "Album") | |
SonyAlbum.create!(:name => "Sony Album") | |
# rake thinking_sphinx:rebuild | |
Product.search.map(&:name) => ["Product", "Album", "Sony Album"] | |
Album.search.map(&:name) => ["Album", "Sony Album"] | |
SonyAlbum.search.map(&:name) => ["Sony Album"] | |
# move define_index into Album | |
class Product < ActiveRecord::Base | |
end | |
class Album < Product | |
define_index do | |
indexes :name | |
end | |
end | |
class SonyAlbum < Album | |
end | |
# rake thinking_sphinx:rebuild | |
Product.search.search.map(&:name) => "undefined method `search'" (obvious) | |
Album.search.search.map(&:name) => ["Album"] | |
SonyAlbum.search.map(&:name) => [] | |
# Problem: explicit "AND `products`.`type` = 'Album'" in WHERE clause of source album_core_0 in development.sphinx.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment