# File lib/thinking_sphinx/facet.rb, line 4 def initialize(name, properties) @name, @properties = name, properties end
# File lib/thinking_sphinx/facet.rb, line 8 def filter_type use_field? ? :conditions : :with end
# File lib/thinking_sphinx/facet.rb, line 12 def results_from(raw) raw.inject({}) { |hash, row| hash[row[group_column]] = row[ThinkingSphinx::SphinxQL.count] hash } end
# File lib/thinking_sphinx/facet.rb, line 21 def group_column @properties.any?(&:multi?) ? ThinkingSphinx::SphinxQL.group_by : name end
# File lib/thinking_sphinx/facet.rb, line 25 def use_field? @properties.any? { |property| property.type.nil? || property.type == :string } end