Hi Jesus

Thinking Sphinx adds an internal attribute, sphinx_deleted, which is set to 
true when records are deleted, and also for records in the core index when 
their delta pair is added. All search requests include a filter on records 
where sphinx_deleted is 0/false, but I'm wondering if that combined with your 
:without filter is confusing things.

What happens if you add a filter to :without excluding deleted records?

  ThinkingSphinx.search 'test', :without => {:published => 1, :sphinx_deleted 
=> 1}

Cheers

-- 
Pat

On 23/08/2011, at 2:08 AM, jatugade wrote:

> Hello,
> 
> I've noticed a difference in results between doing
> ThinkingSphinx.search "test" and ThinkingSphinx.search, :without =>
> '....'
> 
> So here's what I did
> (1) Created a translation (id=1) and set the status to published. Ran
> delta index and the translation was indexed as published.
> (2) Created a new translation (id= 2) off of the published translation
> and set the status to draft. Ran delta index on both the published and
> the draft translations. When I did the following query:
> 
>   ThinkingSphinx.search "test"
>               (1) id=1, published
>               (2) id=2, unpublished
> 
>    ThinkingSphinx.search "test", :without => {'published' => 0}
>               (1) id=1, published
> 
>    ThinkingSphinx.search "test", :without => {'published' => 1}
>              (1) id=1, unpublished     (CORRUPTED, not sure where
> this came from. The AR object this index entry refers to has published
> set to true)
>              (2) id=2, unpublished
> 
> 
> 
> class ContentTranslation < ActiveRecord::Base
>   define_index
>      has published
>      set_property :delta => true
>   end
> 
>   def run_index_delta
>   #update all translations in the same locale
>   ids_of_translations_in_same_locale =
> ContentTranslation.find(:all, :select => "id", :conditions=>
> "content_id='#{self.content_id}' AND locale_id =
> '#{self.locale_id}'").collect{|t| t.id}
>   ContentTranslation.connection.update("UPDATE content_translations
> SET delta = true where id IN
> (#{ids_of_translations_in_same_locale.join(",")})")
> 
> ContentTranslation.search ""
> 
> ContentTranslation.index_delta
>   ContentTranslation.connection.update("UPDATE content_translations
> SET delta = false where id IN
> (#{ids_of_translations_in_same_locale.join(",")})")
>  end
> end
> 
> Thoughts?
> 
> Thank you
> Jesus Tugade
> 
> -- 
> 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