legendary - many thanks.
On Feb 26, 8:08 pm, Dan Pickett <[email protected]> wrote:
> search takes a :classes option for which you can provide an array of classes
> you want to search.
>
> ThinkingSphinx::Search.seach("foo", :classes => [SearchableModel1,
> SearchableModel3])
>
> On Thu, Feb 26, 2009 at 6:29 PM, James Healy <[email protected]> wrote:
>
> > Iro wrote:
> > > I have about 60 models that are configured for indexing and would like
> > > to know if I can search across specific models without doing all of
> > > them. If that is not an option through ThinkingSphinx::Search, could
> > > someone recommend another approach that would allow me to merge 3 or
> > > so models and support paging??
>
> > I haven't tested this, but you could try adding a custom attribute to
> > each model, then searching across all models with filter for that
> > attribute.
>
> > class Model1 < ActiveRecord::Base
> > define_index
> > ..
>
> > has "1", :as => :subset, :type => :integer
> > end
> > end
>
> > class Model2 < ActiveRecord::Base
> > define_index
> > ..
>
> > has "1", :as => :subset, :type => :integer
> > end
> > end
>
> > class Model3 < ActiveRecord::Base
> > define_index
> > ..
>
> > has "2", :as => :subset, :type => :integer
> > end
> > end
>
> > # search across Mode11 and Model2 only
> > ThinkingSphinx::Search.search "blah", :with => {:subset => 1}
>
> > -- James Healy <jimmy-at-deefa-dot-com> Fri, 27 Feb 2009 10:23:44 +1100
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---