This worked.  Thank you!

Andrew

On Mon, Feb 21, 2011 at 4:33 PM, Pat Allan <[email protected]> wrote:
> Hi Andrew
>
> Scopes are tied to single models - so I'm afraid they don't come into play 
> when searching across multiple models.
>
> So, you'll want to add that filter in your application-wide search - but for 
> that to work, you need the attribute in all models. So, for User, Group and 
> Document, add the following:
>
>  has '0', :as => :deleted_at, :type => :integer
>
> Then in searching:
>
>  ThinkingSphinx.search 'foo', :with => {:deleted_at => 0}
>
> As far as Sphinx is concerned, nil/null is the same as 0.
>
> Cheers
>
> --
> Pat
>
> On 22/02/2011, at 11:23 AM, Andrew Gorcester wrote:
>
>> I am using application-wide search over User, Group, Discussion and
>> Document objects.  Discussions are a special case in that they can be
>> "deleted" (deleted_at will be something other than nil).
>>
>> I have this in my user model:
>>
>>    sphinx_scope(:active) {
>>      {:conditions => {:deleted_at => nil}}
>>    }
>>
>>    default_sphinx_scope :active
>>
>> but the default scope does not seem to affect application-wide search;
>> I am still getting deleted comments in my results even after
>> reindexing.
>>
>> Is there any way to use scopes in application-wide search, or a
>> similar concept that will do the job?
>>
>> --
>> 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.
>
>

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