Hi Pat, The solution you suggested looked very much like what I needed. Unfortunately, however, the project I'm working on is using xmlpipe2 as the data source and the method #sphinx_indexes on the individual indexed_models returns an empty array. Would you by any chance how I can still get to the underlying fields and attributes of a particular indexed model? Otherwise, I'll figure out some kind of workaround.
Thank you, Andrea On 9 Apr., 02:20, Pat Allan <[email protected]> wrote: > Hi Andrea > > TS won't figure that out by itself, but you could tell it which classes you > want to search on, using the :classes option. To figure out what to pass in > to that option, you could automate it using a snippet something like this: > > classes = ThinkingSphinx.context.indexed_models.collect { |model| > model.constantize > }.select { |model| > model.sphinx_indexes.first.attributes.any? { |attribute| > attribute.unique_name == params[:attribute] > } > } > > Cheers > > -- > Pat > > On 08/04/2011, at 8:33 PM, Andrea S. wrote: > > > > > > > > > Hi, > > > I am building a search/filter form that is supposed to search > > application wide over multiple models. However, not all models > > actually exhibit the same attributes. Many are in common, but not all. > > I saw that some people set up dummy attributes for that purpose, but > > in my case that would not be a viable solution. > > > I was wondering whether there is a way to conduct a multi-model > > search, but limit it to the models that actually have those specified > > attributes sent in through the filter form. In other words, can > > ThinkingSphinx based on a given attribute figure out which model(s) > > have that attribute set up? > > > Thanks, > > > Andrea > > > -- > > 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 > > athttp://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.
