Hi Roger

Not quite - a global search is actually across all indices at once. It's just 
when these results are translated into ActiveRecord objects, each model 
receives one find call - but the context of the search results is maintained.

If that wasn't the case, then yes, you'd be right, each model's default scope 
should be respected - but it doesn't apply in this situation. It's just a 
single search call, one set of conditions, one set of filters, etc.

Cheers

-- 
Pat

On 25/07/2012, at 10:08 AM, Roger Kind Kristiansen wrote:

> Hi Pat,
> 
> I'll see if I can have a closer look at the source code to make some more 
> informed questions soon. But if my memory serves me right, isn't the global 
> search really just an abstraction for searching each individual model by 
> itself? It's not really an entirely different beast, right? And if so, 
> wouldn't it be easy and kind of logical to have an option for wanting to 
> respect each models scope? In my mind this would also be the most logical 
> default setting, but I see that this would break stuff for people already 
> using scopes and global search.
> 
> Not trying to be difficult here, just trying to understand. :-)
> 
> Cheers,
> Roger
> 
> 
> kl. 22:49:40 UTC+2 tirsdag 17. juli 2012 skrev Pat Allan følgende:
> Hi Roger
> Yes, that's correct - scopes are tied to single models, and a global search 
> isn't in the scope of any model. Thus, Thinking Sphinx doesn't try to use any 
> scopes.
> 
> I'm afraid there's no way around this beyond adding the filter into the 
> search manually yourself - though if you have thoughts on how TS could be 
> improved in these scenarios, I'm certainly interested to hear them :)
> 
> -- 
> Pat
> 
> On 17/07/2012, at 7:01 PM, Roger Kind Kristiansen wrote:
> 
> > I've just added functionality for setting entries in some of my models as 
> > inactive, and I never want to have those returned in a search.
> > 
> > Therefore I added a sphinx_scope and set this as my default_sphinx_scope. 
> > This all works perfectly when searching single models, but when performing 
> > a search across multiple models it seems this scope is ignored. I glanced 
> > quickly at the code, and, it seems this is by design 
> > (lib/thinking_sphinx/search.rb:add_default_scope()).
> > 
> > Is that correct, and is there any other way for me to apply the scope to a 
> > selection of the models I'm searching?
> > 
> > Cheers,
> > Roger K. Kristiansen
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Thinking Sphinx" group.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/thinking-sphinx/-/TUTtbuTPKcoJ.
> > 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 view this discussion on the web visit 
> https://groups.google.com/d/msg/thinking-sphinx/-/SNyLT9qKSHYJ.
> 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