두 모델의 사용자 및 토론이 있습니다. 토론 모델Rings가있는 스핑크스를 생각해보십시오 - 델타 색인은 한 모델에서는 잘 작동하지만 다른 모델에서는 작동하지 않는 것 같습니다.
define_index do
indexes email
indexes first_name
indexes last_name, :sortable => true
indexes groups(:name), :as => :group_names
has "IF(email_confirmed = true and status = 'approved', true, false)", :as => :approved_user, :type => :boolean
has "IF(email_confirmed = true and (status = 'approved' or status='blocked'), true, false)", :as => :approved_or_blocked_user, :type => :boolean
has points, :type => :integer
has created_at, :type => :datetime
has user(:id)
set_property :delta => true
end
:
사용자 모델 : 나는이 문서에 따라 두 테이블에 델타 열을 추가 한
define_index do
indexes title
indexes description
indexes category(:title), :as => :category_title
indexes tags(:title), :as => :tag_title
has "IF(publish_to_blog = true AND sticky = false, true, false)", :as => :publish_to_main, :type => :boolean
has created_at
has updated_at, :type => :datetime
has recent_activity_at, :type => :datetime
has views_count, :type => :integer
has featured
has publish_to_blog
has sticky
set_property :delta => true
end
나는 아래와 같은 모델 인덱스를 정의 . 내 문제는 델타 인덱싱은 사용자 모델이 아닌 토론 모델에서만 작동한다는 것입니다. 예 : 토론의 '제목'을 업데이트하면 스핑크스가 인덱스 등을 회전시키고있는 것을 볼 수 있습니다 (로그에서 분명함). 그러나 사용자의 'first_name'또는 'last_name'을 업데이트하면 아무 일도 일어나지 않습니다.
사용자 모델에는 GroupsUser라는 모델을 통한 has_many : through 연결이 있습니다.
def set_user_delta_flag
user.delta = true
user.save
end
심지어이 사용자 모델에 델타 색인을 유발하지 않는 것 다음과 같이 내가 설정에게 GroupsUser에 after_save 있습니다. Discussion 모델에 대한 비슷한 설정이 완벽하게 작동합니다! 아무도 왜 이것이 일어나고 있는지 말해 줄 수 있습니까?