Hi Matt I'm not entirely sure what problem Dan is having with the class facets - so hopefully it'll still work for you. You should just be able to do the following:
ThinkingSphinx::Search.facets() This returns all facets common to all models, including the model facet. If you just want the model facet, try the following: ThinkingSphinx::Search.facets()[:class] The #facets call can take the same arguments as a normal #search call. Cheers -- Pat On 01/05/2009, at 8:54 AM, matt wrote: > > Ok, thanks - how do I setup/use class based factes (ass opposed to > single model facets?). > > Matt > > > On Apr 30, 10:28 am, Dan Pickett <[email protected]> wrote: >> Hey Matt, >> >> This is something I accomplish with class facets - there seems to >> be an >> issue with them in master (at least for me) that I'm trying to get >> to the >> bottom of - I'll keep you posted >> >> >> >> On Wed, Apr 29, 2009 at 6:41 PM, matt <[email protected]> wrote: >> >>> We're currently indexing multiple models, and search across all of >>> them from a single page. I'd like to be able to breakdown how >>> many of >>> each model I found in the search results, but display the results >>> from >>> a cross model search. This lets our users click on one of the >>> counts >>> to filter the search results to just that model. I'm currently >>> doing >>> this with multiple sphinx queries, but was wondering if anyone >>> knew of >>> a better way to do it. This is what I have: >> >>> @counts[:foo_model] = FooModel.search(params[:q]).total_entries >>> @counts[:bar_model] = BarModel.search(params[:q]).total_entries >>> @results = ThinkingSphinx::Search.search(params[:q]) >> >>> Ideally, I'd just have to make the one call to the global search, >>> and >>> be able to extract the counts for each model out of that. Any help >>> appreciated, >> >>> Thanks, >> >>> Matt >> >> -- >> ========================= >> Dan Pickett >> Principal >> Enlight Solutions, Inchttp://EnlightSolutions.com >> >> http://www.twitter.com/dpickett > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
