It seems that reloading models in development mode breaks facets. If i do ThinkingSphinx.facets(params[:q]) once, everything is fine, but subsequent calls to that method in development mode raises the following NoMethodError
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.any? vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 70:in `facet_classes' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 69:in `select' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 69:in `facet_classes' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 74:in `all_facets' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 82:in `facet_names_for_all_classes' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 93:in `facet_names_common_to_all_classes' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 28:in `facet_names' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 45:in `populate' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/facet_search.rb: 11:in `initialize' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search_methods.rb: 404:in `new' vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search_methods.rb: 404:in `facets' app/controllers/search_controller.rb:19:in `show' /opt/local/bin/mongrel_rails:19:in `load' /opt/local/bin/mongrel_rails:19 I'm sure I can find a way to fix this, but in thinking about patching it, I'm curious if re-evaluating the define_index block on each request is intentional or not? Should the goal be to make it reload and define the facets properly or should the goal be to skip the define_index call if reloading the model? thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
