Hi Andrey

The option does indeed exist - it's :indices, and it expects an array of index 
names. So:

  Service.search params[:query], indices: ['service_public_core']
  Service.search params[:query], indices: ['service_admin_core']

Cheers

-- 
Pat

On 1 Sep 2014, at 10:06 pm, Andrey Novikov <[email protected]> wrote:

> Hello.
> 
> I need to do a search for models (one of them is called 'Service') in both 
> public interface and admin interface.
> 
> So, I've created indexes:
> 
> ThinkingSphinx::Index.define :service, name: 'service_public', with: 
> :active_record do
>   # indexes, has, and so on
>   where sanitize_sql("published = 't' AND published_at < NOW() AND 
> infoblocks.service_id IS NOT NULL") # Only published services that have 
> pretty image and content in main page
> end
> 
> ThinkingSphinx::Index.define :service, name: 'service_admin', with: 
> :active_record do
>   # same indexes, has, and so on
>   # Absolutely all services goes here
> end
> 
> But how to restrict search in different interfaces for different indexes?
> 
> I've searched docs, internets and this group, but haven't found working 
> solution. Currently I'm on today `develop` branch.
> 
> Something like this would be great (and it doesn't work):
> 
> Service.search params[:query], index: 'service_public_core'  # for public 
> interface
> Service.search params[:query], index: 'service_admin_core'   # for admin 
> interface
> 
> Thank you for great gem!
> 
> -- 
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to