-->

深协会与思考狮身人面像斯芬克斯指数?(Deep association and Sphinx ind

2019-09-17 01:16发布

目前,我有FF表:

Teams
id

Team_User
team_id, user_id

Users
user_id

Item
id
team_id

和FF。 模型:

Team
has_and_belongs_to_many :users

User
has_and_belongs_to_many :teams

Item
belongs_to :audit_team, :class_name => "Team", :foreign_key => "team_id"

为什么我试图存档是让狮身人面像索引所有与项目关联的USER_ID,我想出了这个指标定义:

  define_index do
    has audit_team.users(id), :as => :team_users
  end

我不知道这是否正确与否。 此外,它的接缝思考狮身人面像没有建立这个配置。 正如我重建,重新索引和运行应用程序时,FF。 错误显示出来:

index ncpar_core: no such filter attribute 'team_users'

可能是什么问题,我如何可以存档吗?

非常感谢你

Answer 1:

您可能需要运行TS:添加属性,这样斯芬克斯是意识到这一点后重建。 此外,也许是在这里,而不是在你的代码一个错字,但id在属性定义应该是一个符号:

has audit_team.users(:id), :as => :team_users


文章来源: Deep association and Sphinx index with Thinking Sphinx?