I think I can shed some light on what might be happening, although I
don't have a clear solution.

When your product instance is updated and added to the Delta index, it
remains in the core index. The core index has a sphinx_deleted attribute
that TS uses to identify core index records that should be ignored. Once
a record is in the delta index, the sphinx_deleted attribute in the
matching core index record needs to be toggled on.

If this fails, your product will be returned if a search matches it in
the core OR delta index.

For delayed deltas, the sphinx_deleted toggle is handled by an
additional delayed job, defined here:

  lib/thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job.rb

Can you verify that the task is being added to the queue and executing
correctly?

-- James Healy <jimmy-at-deefa-dot-com>  Mon, 17 Aug 2009 11:19:59 +1000

joesimms wrote:
> 
> We have an issue running delta indexes and then filtering with
> attributes.
> 
> I present our configuration below:
> 
> class Product
>   define_index do
>      # State can be 'in_stock', 'out_of_stock'
>      has "CRC32(products.state)", :type => :integer, :as => :state
>   end
> end
> 
> We have a multi application server deployment and are using delayed
> delta's.
> Our database sever, sphinxd and job runner all run from the same
> machine (dbserver).
> Our application servers DO NOT run searchd and do not have access to
> the index files on the dbserver. We assume that as the delta indexing
> is done via the job runner directly on the dbserver this is not
> required.
> 
> Our production.rd contains:
> ThinkingSphinx.remote_sphinx = true
> 
> and sphinx.yml points the address to the dbserver where searchd is
> running:
> production:
>   address:  dbserver
> 
> The problem we experience is the following:
> 
> Product.search('', :with => {:state => Zlib.crc32('in_stock')}) let's
> say returns records with id 1,2,3
> 
> Then we update the state of 1
> 
> Product.find(1).update_attribute(:state => 'out_of_stock')
> 
> Once the job runner has run (next to no delay) we can run the
> following and id:1 is returned, so the delta has worked correctly,
> these results are returned from all app servers:
> 
> Product.search('', :with => {:state => Zlib.crc32('out_of_stock')})
> 
> BUT
> 
> The record is also still present in the following resultset
> Product.search('', :with => {:state => Zlib.crc32('in_stock')})
> 
> This problem only exists in our production configuration outlined
> above, when we perform these test on a single machine in dev then
> there are no problems.
> 
> Any help would much appreciated.
> 
> Many thanks
> 
> Joe
> 
> 
> 
> 
> 
> --~--~---------~--~----~------------~-------~--~----~
> 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
> -~----------~----~----~----~------~----~------~--~---
> 

Attachment: signature.asc
Description: Digital signature

Reply via email to