Hi Shripad

Sorry for the delay here.

The reason you're not getting results is because Thinking Sphinx has its own 
after_delete hook in the model - when a record is 'deleted', the sphinx_deleted 
attribute is set to true. If you want to get this records back as well, you 
need to filter on that attribute:

  Contacts.search params[:q],
    :with => {:deleted_at => true, :sphinx_deleted => true},
    :star => true,
    :limit => 10_000

Give that a shot.

Cheers

-- 
Pat

On 22/07/2011, at 8:50 PM, Shripad Joshi wrote:

> Hi all,
> 
> I am using Thinking sphinix for searching records in my project
> I also used acts_as_paranoid for soft delete.
> When I am searching for deleted/deactivated records, I won't be able
> to search those records.
> My Code consist of following things
> 
> 1. Model file (Contact.rb)
>  acts_as_paranoid
>  define_index do
>    #set_property :delta => true
>    indexes :name, :prefixes => true
>    has :deleted_at
> 
>  end
> 2. In Contact Controller
>  Contacts.search "*" + params[:q] + "*", :with => {:deleted_at =>
> true}, :star => true, :limit => 10000
> 
> I am not getting any deleted record.
> 
> Index is generating properly,
> 
> Using following command I searched on command window it gives me all
> the records (deleted and not deleted)
> search --config config/development.sphinx.conf "*ab*"
> but when I executed it on ruby console it is not giving records which
> fulfill criterion which are deleted.
> I am thinking there might be issue regarding scope conflict between
> acts_as_paranoid and thinking_sphinx
> Please help me out
> 
> Thanks and Regards,
> Shripad Joshi
> 
> -- 
> 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