Hi Victor I know it's been a long time since we last looked at this - sorry, work was crazy, and a lot fell by the wayside.
>From scanning through the code here, I'm not spotting anything immediately >obvious. Delta values will get set to 0 after a full index - and then when you >modify a single record, it should change to true, invoke a delta index (you'll >find it in the error log of apache/nginx if you're using Passenger), and >remain at 1 until the next full index. How are you testing to make sure the changes are/are not indexed? Maybe you've found a solution in the meantime? -- Pat On 23/11/2010, at 2:07 AM, Victor wrote: > Hi Pat, > > Sorry for not being clear. Was pulling my hair doing it. > > Migration file > ================== > class AddDeltaToSpotsAndTripsAndTripDay < ActiveRecord::Migration > def self.up > add_column :spots, :delta, :boolean, :default => true, :null => > false > add_column :trips, :delta, :boolean, :default => true, :null => > false > add_column :trip_days, :delta, :boolean, :default => true, :null > => false > end > > def self.down > remove_column :spots, :delta > remove_column :trips, :delta > remove_column :trip_days, :delta > end > end > > > spot.rb > ============== > class Spot < ActiveRecord::Base > > has_many :trips, :through => :spot_trips > > after_save :set_trip_day_delta_flag > > # ThinkingSphinx Index > define_index do > indexes :name, :sortable => true > indexes address > indexes city > indexes state > indexes country > indexes spot_type > indexes season > indexes description > has rating_average > > set_property :delta => true > end > > private > > def set_trip_day_delta_flag > trip_day.delta = true > trip_day.save > end > > end > > > trip.rb > ============== > class Trip < ActiveRecord::Base > > has_many :spots, :through => :spot_trips > has_many :trip_days, :dependent => :destroy > > after_save :set_trip_day_delta_flag > > # ThinkingSphinx Index > define_index do > indexes name > indexes duration > #indexes spots.name, :as => :trip_spot_name > #indexes spots.city, :as => :trip_spot_city > #indexes spots.state, :as => :trip_spot_state > #indexes spots.country, :as => :trip_spot_country > has budget, created_at, rating_average > > set_property :delta => true > end > > private > > def set_trip_day_delta_flag > trip_day.delta = true > trip_day.save > end > > end > > > > trip_day.rb > =========== > class TripDay < ActiveRecord::Base > > belongs_to :trip > has_many :spots, :through => :trip_day_spots > > # ThinkingSphinx Index > define_index do > indexes spots.name, :as => :spot_name > indexes spots.city, :as => :spot_city > indexes spots.state, :as => :spot_state > indexes spots.country, :as => :spot_country > indexes spots.season, :as => :spot_season > indexes trip.name, :as => :name, :sortable => true > indexes trip.duration, :as => :duration > has trip.budget, :as => :budget > has trip.created_at, :as => :created_at > has trip.rating_average, :as => :rating_average > has trip_id > > set_property :delta => true > end > > end > > > > Some scenarios: > 1. In my development, the delta column all are 1's, whether or not an > entry is updated. > 2. In my production, the delta column all are 0's. When I could update > it (where I actually forgot adding the set_trip_day_delta_flag), the > respective column would change to 1 until next index. The delta won't > be indexed though. > > Maybe we should ignore the previous error message, and start from > scratch to see if the code is right. > > Thanks a bunch Pat. > > > On Nov 22, 9:42 pm, Pat Allan <[email protected]> wrote: >> Hi Victor >> >> I'm not quite sure what this 'set_trip_day_delta_flag' method is you're >> referring to. Remind me again: what does your model look like? What is this >> method supposed to do? >> >> Cheers >> >> -- >> Pat >> >> On 22/11/2010, at 8:23 PM, Victor wrote: >> >>> Hi Pat, >> >>> On the move to setting up delta index. Have followed steps outlined. >> >>> When I try to save an entry without set_model-name_delta_flag, the >>> delta column of that database table will be changed from 0 to 1, but >>> don't get indexed. >> >>> When I try to save an entry with set_model-name_delta_flag (declared >>> under private), it gave this 500 internal server error: >> >>> NameError (undefined local variable or method `trip_day' for #<Spot: >>> 0x9e02ab4>): >>> app/models/spot.rb:104:in `set_trip_day_delta_flag' >> >>> But the entry is saved anyway, but not indexed. Delta column for this >>> table remains 0. >> >>> What have I done wrong? >> >>> Thanks. >> >>> -- >>> 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 >>> athttp://groups.google.com/group/thinking-sphinx?hl=en. >> >> > > -- > 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. > -- 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.
