class ThinkingSphinx::FacetSearch

Attributes

args[RW]
options[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/thinking_sphinx/facet_search.rb, line 5
def initialize(*args)
  ThinkingSphinx.context.define_indexes
  
  @options      = args.extract_options!
  @args         = args
  
  set_default_options
  
  populate
end

Public Instance Methods

facet_names() click to toggle source
# File lib/thinking_sphinx/facet_search.rb, line 27
def facet_names
  @facet_names ||= begin
    names = options[:all_facets] ?
      facet_names_for_all_classes : facet_names_common_to_all_classes
    
    names.delete class_facet unless options[:class_facet]
    names
  end
end
for(hash = {}) click to toggle source
# File lib/thinking_sphinx/facet_search.rb, line 16
def for(hash = {})
  for_options = {:with => {}}.merge(options)
  
  hash.each do |key, value|
    attrib = ThinkingSphinx::Facet.attribute_name_from_value(key, value)
    for_options[:with][attrib] = underlying_value key, value
  end
  
  ThinkingSphinx.search *(args + [for_options])
end