I realise this has been addressed before.  I have tried various methods of 
making this work with no success.  It works in development, but not 
production.  As you can see from the details below, no records are found 
after an update until ts:index is run.

Any ideas gratefully received.

many thanks,

Mike

class ModelA 

  belongs_to :model_b

end


class ModelB 

  has_many :model_a

  after_save :set_legislation_per_clients_delta_flag


  def set_model_a_delta_flag

    self.model_as.update_all(delta: true)

    ThinkingSphinx::Deltas::IndexJob.new('model_as_delta').perform

  end

end


model_b_index.rb

ThinkingSphinx::Index.define :model_a, :with => :active_record, :delta => 
true do

    indexes model_b.title,:as => :model_b_title

end


model_b = ModelB.last

ModelA.search("XXXX")

[]

bundle exec rake RAILS_ENV=production ts:index

ModelA.search("XXXX")

[1 record found]

The delta has been set to true in model_a for both searches above.


Sphinx 2.2.7

thinking-sphinx 3.1.3

rails 3.2.21

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to