On 03/03/2011, at 6:50 PM, gmoniey wrote:

> Couple of questions that might help me debug:
> 
> 1. How is a job actually assigned? Is it solely off the delta bit? If
> so, how does DelayedJob know if I make multiple changes to the same
> model before re-indexing? i.e. I change the model at 11:00, and the
> delta bit goes to true. DelayedJob picks it up, and now the change is
> returned in my search results. Since the delta bit doesn't go to
> false. If I make a change at 12:00, how does DelayedJob know to pick
> up this change as well?

The delta bit is set so the indexer knows which records have changed. Thinking 
Sphinx does look at that, but it's not the *changing* of that value that 
prompts the delta indexing to start.

The short answer: when the model is changed, the delta bit is set *and* a job 
is added to the queue. When that job is processed, it processes just the delta 
index of that model. The long answer: have a look through the ts-delayed-delta 
gem code - there's not too much to it :)

> 2. Are there any logs specific to delta indexing that I can look at?

The delta indexing logs should be in your delayed job logs.

Cheers

-- 
Pat

> 
> Thanks.
> 
> On Mar 2, 10:26 pm, Pat Allan <[email protected]> wrote:
>> Hmm - the delta flag should stay true even after the delta indexing jobs run 
>> - they stay true until the next time all indices are processed.
>> 
>> When you say that the process isn't picking up changes on certain models - 
>> is a job being added to the queue, and the job does nothing? Or is there no 
>> job? Or something else? :)
>> 
>> --
>> Pat
>> 
>> On 01/03/2011, at 2:30 PM, gmoniey wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> I'm seeing some weird behavior with DelayedJob, and I can't quite
>>> explain it. For some reason the delayed job process is not picking up
>>> delta changes on certain models. The delta bit is being correctly set
>>> across the board, but it stays true (1) for a specific model. The only
>>> way to fix this is to rebuild the indexes.
>> 
>>> My define index looks like:
>> 
>>> define_index do
>>>    indexes :first_name, :sortable => true
>>>    indexes :last_name, :sortable => true
>>>    indexes :email, :sortable => true
>> 
>>>    has :deleted, :owner_id, :phone, :title
>>>    has 'CRC32(owner_table)', :as => :owner_table, :type => :integer
>>>    set_property :delta => :delayed
>>>    set_property :field_weights => {:first_name => 10, :last_name =>
>>> 7, :email => 5 }
>>>  end
>> 
>>> My delayed job worker looks like:
>> 
>>> #!/usr/bin/env ruby
>>> require 'rubygems'
>>> require 'daemon-spawn'
>> 
>>> WORKING_DIR = File.expand_path(File.join(File.dirname(__FILE__),
>>> '../../..'))
>>> PID_FILE = File.join("/u/apps/test/shared/pids/", "delayed_job.pid")
>> 
>>> class DelayedJobWorker < DaemonSpawn::Base
>>>  def start(args)
>>>    ENV['RAILS_ENV'] ||= args.first || 'development'
>>>    Dir.chdir WORKING_DIR
>>>    require File.join('config', 'environment')
>> 
>>>    Delayed::Worker.new.start
>>>  end
>> 
>>>  def stop
>>>    system("kill `cat #{PID_FILE}`")
>>>  end
>>> end
>> 
>>> DelayedJobWorker.spawn!(:log_file => File.join("/u/apps/test/shared/
>>> log/", "delayed_job.log"),
>>>                        :pid_file => PID_FILE,
>>>                        :working_dir => WORKING_DIR,
>>>                        :app_name => 'delayed_job',
>>>                        :sync_log => true,
>>>                        :singleton => true,
>>>                        :timeout => 5)
>> 
>>> and my sphinx.yml looks like:
>> 
>>> production:
>>>  version: 0.9.9
>>>  mem_limit: 256M
>>>  enable_star: 1
>>>  min_infix_len: 1
>>>  morphology: stem_en
>>>  charset_table: "0..9, A..Z->a..z,a..z, _, -, /, @, !, $, %, ^, &,
>>> (, ), +, `, ~, #"
>>>  bin_path: "/usr/local/bin"
>>>  config_file: "/u/apps/test/shared/config/production.sphinx.conf"
>>>  searchd_file_path: "/u/apps/test/shared/system/sphinx"
>>>  searchd_log_file: "/u/apps/test/shared/log/searchd.log"
>>>  query_log_file: "/u/apps/test/shared/log/searchd.query.log"
>>>  pid_file: "/u/apps/test/shared/pids/searchd.pid"
>> 
>>> All the logs look fine, and I'm not sure whats going on. Any ideas on
>>> why this table is not being queried?
>> 
>>> 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.

Reply via email to