Hi All,
I am trying to use thinking sphinx plug-in into my application. But I
am stuck with issue, which are as follows,.
class Student < ActiveRecord::Base
has_many :subjects, :dependent => :destroy
after_save :set_subject_delta_flag
def set_subject_delta_flag
self.subjects.each do |sub|
sub.delta = true
sub.save
end
end
define_index do
set_property :enable_star => true
set_property :min_prefix_len => 3
set_property :morphology => 'none'
set_property :delta => true
indexes :Name, :prefixes => true
indexes :address, :prefixes => true
indexes subjects.name, :as => :subject_name
end
end
class Subject < ActiveRecord::Base
belongs_to :student
validates_presence_of :student_id
after_save :set_student_delta_flag
def set_student_delta_flag
student.delta = true
student.save
end
define_index do
set_property :enable_star => true
set_property :min_prefix_len => 3
set_property :morphology => 'none'
set_property :delta => true
indexes :name, :prefixes => true
indexes student.Name, :as => :student_name
has student_id
end
end
In above implementation if I try to update any one object of any model
it goes into to infinite loop since they calling each others callback.
But if I comment callback of any model, then that model won't get
updated with newly updated value of other index.
It still refers old value.
Is there any other way to do same.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.