Hi Chris Unfortunately, there's no way to have a 'blank slate' Search object. I'd either be making the view handle nil/empty search results objects, or possibly creating a placeholder class (BlankSearch?) that had total_entries returning 0, and use that in your controller. Neither's ideal...
Good to know the results are now consistent :) Cheers -- Pat On 22/07/2010, at 9:12 AM, Chris McCann wrote: > Pat, > > Since correcting the code to not apply filters inappropriately the bug > we had with inconsistent results seems to have gone away. I wish I > could explain exactly why that is but for now we'll keep pressing > forward. > > Fixing that bug, though, revealed an unintended (and desired) > consequence of generating that error. Sphinx would return a > ThinkingSphinx::Search object with no results, and that's desirable in > the case of where we want to target the search at just one of three > models -- the other two shouldn't return results. > > The view that displays the search results, however, is very tied to > the sphinx results (especially the :total_entries method) for all > three models. Is there a way to either have thinking sphinx return an > empty search result object without paying the price of running a bogus > search that we know won't return any results or to instantiate an > empty ThinkingSphinx::Search object that can respond to :total_entries > without having to actually call .search on a model? > > Thanks for all your help -- we're getting close to having this working > quite nicely. > > Cheers, > > Chris > > -- > 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. > -- 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.
