lib/thinking_sphinx/facet_search.rb in warp-thinking-sphinx-1.2.12 vs lib/thinking_sphinx/facet_search.rb in warp-thinking-sphinx-1.3.10
- old
+ new
@@ -1,10 +1,12 @@
module ThinkingSphinx
class FacetSearch < Hash
attr_accessor :args, :options
def initialize(*args)
+ ThinkingSphinx.context.define_indexes
+
@options = args.extract_options!
@args = args
set_default_options
@@ -62,10 +64,10 @@
)
end
def facet_classes
(
- options[:classes] || ThinkingSphinx.indexed_models.collect { |model|
+ options[:classes] || ThinkingSphinx.context.indexed_models.collect { |model|
model.constantize
}
).select { |klass| klass.sphinx_facets.any? }
end