Hi Simone,

Sorry for the delay in responding to this.

The default scope only has an impact when inserting/updating all records into 
Sphinx (via ts:index/ts:rebuild). If changes are made to a soft-deleted 
instance which fires the callback there, then the real-time processing will do 
its thing on just that record, and it’ll find itself back in Sphinx.

Also, as you’ve noted, ts:index does not delete existing records - it just 
updates existing ones and inserts new ones. A rebuild, on the other hand, 
clears out existing index data first.

If you’re not using a default scope, then you can set your real-time index’s 
scope to load only what you want:
https://freelancing-gods.com/thinking-sphinx/v4/real_time.html#eager-loading-associations
 
<https://freelancing-gods.com/thinking-sphinx/v4/real_time.html#eager-loading-associations>

And to avoid callback behaviour in these soft-deleted instances, instead of 
using the default TS approach, you’ll want to have your own callback instead:
https://freelancing-gods.com/thinking-sphinx/v4/indexing.html#callbacks 
<https://freelancing-gods.com/thinking-sphinx/v4/indexing.html#callbacks>

Hope all this helps! Do let me know if there are further questions.

Cheers,

— 
Pat

> On 6 Feb 2019, at 8:34 pm, Simone Miller <simhmil...@gmail.com> wrote:
> 
> Hi Pat
> 
> May I check in with you about an issue we're having with soft deleted users 
> being filtered out of searches? 
> 
> We're runnning thinking sphinx 4.0.0 with real time indices, soft deleting 
> users (without active record destroy callbacks) and have a default scope on 
> users { where(:deleted_at => nil) }
> We run 'flying-sphinx regenerate' each night - after which deleted users no 
> longer show up in searches. Are we right in thinking that having the default 
> scope means deleted users won't be added to the index?
> 
> We are going to remove the default scope! In the meantime, is there a way to 
> prevent thinking-sphinx from filtering out deleted users / unscoping our 
> default scope when the index is being generated? We're trying to avoid batch 
> updating deleted users to manually trigger real time callbacks.
> 
> We also noticed in development that running rake ts:index doesn't filter out 
> deleted users, but running rake ts:rebuild does. Could you explain why this 
> is?
> 
> Thank you
> Simone
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to thinking-sphinx+unsubscr...@googlegroups.com 
> <mailto:thinking-sphinx+unsubscr...@googlegroups.com>.
> To post to this group, send email to thinking-sphinx@googlegroups.com 
> <mailto:thinking-sphinx@googlegroups.com>.
> Visit this group at https://groups.google.com/group/thinking-sphinx 
> <https://groups.google.com/group/thinking-sphinx>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to thinking-sphinx+unsubscr...@googlegroups.com.
To post to this group, send email to thinking-sphinx@googlegroups.com.
Visit this group at https://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to