We use delayed_delta indexing (TS-1.1.14, sphinx-0.9.9, Rails 2.3.4)

The symptom was that delayed indexing works find in production
(RAILS_ENV=production) but Delayed::Jobs were not getting enqueued in
development mode (RAILS_ENV=development).

It looks like the culprit was ThinkingSphinx::Attributed#live_value
hitting an exception ("undefined method").  It's called when
after_commit fires off update_attribute_values (which calls
attribute_values_for_index which calls live_value).

I am assuming that in production, these exceptions get thrown but
something catches them and the after_commit :index_delta still gets to
run.  Perhaps in development mode, things aren't so forgiving?

It looks like live_value runs into a problem with

 has permissionables(:readable), :as => :permissionable_kludge, :type
=> :boolean

[I have this defined so an OUTER JOIN gets emitted to permissionables]

The stack is object, :permissionables, :readable, so live_value does

object = object.send(:permissionables)

now object is an array of permissionables.  the array doesn't define
":readable" so we then get the undefined method error next time
through the loop.

I don't understand what any of this code is for, so I don't know the
best fix (perhaps this is just a documentation oversight and I'm mis-
using has() or perhaps I didn't properly read the docs).

My kludgey fix (kludge on top of kludge) was to change the has line to
refer to a string and change the type to string so it gets excluded
from the array that attribute_values_for_index iterates down.

Thanks again for a great package!

-- Jason
-- 
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