Hi Pat, We are seeing some strange behaviour where attributes are sometimes updated live, and some times they are not.
I think I've tracked the problem down to this:
Say I have a Post in the main index with a 'status' of 1.
If I update its 'status' to 2, the main index is updated in-memory and now I
can search for that Post using :with => {:status => 2}
Next, I update Post#title, delayed delta kicks in, and the Post is now in the
delta index as well, with a 'status' equal to 2 and Post#delta is set to true
in MySQL.
If I now update the Post again, by setting its 'status' to 3, ONLY THE MAIN
INDEX is updated (lines 26-28 of attribute_update.rb).
However, if I search :with => {:status => 2} it would seem that Thinking Sphinx
goes off and searches both indexes but selects the result from the delta index
(due to Post#delta being true) which still has the old 'status' value of 2.
The question is, shouldn't both main and delta indexes be updated in
attribute_update.rb?
-christos
(apologies for re-awaking this thread, but I think it is relevant)
On 4 May 2010, at 12:33, Pat Allan wrote:
> Yes, Thinking Sphinx supports live updates of attributes - but not *ALL*
> attributes.
>
> Currently, it only supports integer, boolean and timestamp updates, and only
> those built directly from model columns - ie: not any attributes built from
> manual SQL snippets.
>
> --
> Pat
>
> On 04/05/2010, at 7:58 PM, Christos Zisopoulos wrote:
>
>> Hi there,
>>
>> Having read the documentation, and this thread:
>>
>> http://groups.google.com/group/thinking-sphinx/msg/923095bb1888e579
>>
>> I am having trouble understanding if Thinking Sphinx (1.3.14 w/
>> riddle-1.0.8, and sphinx 0.9.9) actually supports live, in-memory
>> updates of index attributes.
>>
>> I have a simple model:
>>
>> class Post < ActiveRecord::Base
>> # post has a status of 0 by default
>> define_index do
>> has status
>> end
>> end
>>
>> If I do:
>>
>> Post.search :with => {:status => 1} # 0 results
>>
>> Post.first.update_attributes(:status => 1}
>> Post.search :with => {:status => 1} # I get the 1 result
>> (Post.first)
>>
>> I have delayed deltas set up, but the rake task to process them is not
>> running and the sphinx index files are not modified when I run
>> 'update_attributes'.
>>
>> If I kill searchd with a 'kill -9', the index reverts to all Posts
>> with a status of 0. If I shutdown gracefully, the index is updated and
>> there is now a Post with a status of 1.
>>
>> Looking at the 'update' and 'update_message' method of the
>> riddle-1.0.8 client I am guessing that the attributes *ARE* actually
>> updated in memory (at least for sphinx 0.9.9)
>>
>> Can someone shed some light on this?
>>
>> Am I dreaming? Is it actually working? Is it 0.9.9 specific? Any
>> caveats?
>>
>> --
>> 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.
>
smime.p7s
Description: S/MIME cryptographic signature
