class User < ActiveRecord::Base
has_many :followings, :as => :followable, :dependent => :destroy, :class_name => 'Follow'
has_many :follows, :as => :follower, :dependent => :destroy
define_index do
has follows.followable(:id), :as => :followable_id
has followings.follower(:id), :as => :follower_id
has follows.followable(:type), :as => :followable_type
has followings.follower(:type), :as => :follower_type
end
end 谢谢!
发布于 2010-11-27 09:54:21
关于第一个问题,字符串过滤器不适用于狮身人面像。这种情况在将来应该会改变(一旦考虑到Sphinx支持新特性,将使用Sphinx1.10-beta),但不确定何时会发生这种情况(我很想说,但什么也不能保证)。
有可用的解决办法,尽管.但是请记住,您正在处理一个字符串数组,因此这是一个额外的复杂性级别。
至于第二个问题,我很难弄清楚数据库是什么样子(名字让人费解,但我现在还没有集中注意力),所以我现在就把它放在这里。
https://stackoverflow.com/questions/4290756
复制相似问题