使用 ActiveRecord 连接 Thinking Sphinx

Using ActiveRecord joins with Thinking Sphinx

当使用具有从 class A 到 B 的 has_one 关联的 Thinking Sphinx 时(B 具有 belongs_to 语句),在 A 上建立索引,可以使用 has_many 索引与连接语句的关联。当然,这会导致 SphinxQL 查询按 B 的主键分组。但是,当我尝试使用与 B 上的索引相同的关联时,我显然不能在 belongs_to 端使用关联。我的问题是,是否可以使用 belongs_to 关联,或者是否有解决方法?以下是我的代码的相关部分:

class IdentAssociation < ActiveRecord::Base
  has_many :donees, :foreign_key => :ident_id, :class_name => "Donees"
...

class Donees < ActiveRecord::Base
  belongs_to :ident_association, :foreign_key => :ident_id
...

ThinkingSphinx::Index.define :donees, :with => :active_record do
  join ident_association
...

是的,我想我一定是打错了协会的名字。我还遇到了一些其他的问题,比如 sphinx 抱怨缺少 sphinx_internal_class_name;但这超出了范围。