Class: ThinkingSphinx::FacetSearch
- Inherits:
-
Hash
- Object
- Hash
- ThinkingSphinx::FacetSearch
- Defined in:
- lib/thinking_sphinx/facet_search.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #facet_names ⇒ Object
- #for(hash = {}) ⇒ Object
-
#initialize(*args) ⇒ FacetSearch
constructor
A new instance of FacetSearch.
Constructor Details
#initialize(*args) ⇒ FacetSearch
Returns a new instance of FacetSearch.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/thinking_sphinx/facet_search.rb', line 5 def initialize(*args) ThinkingSphinx.context.define_indexes @options = args. @args = args populate end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/thinking_sphinx/facet_search.rb', line 3 def args @args end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/thinking_sphinx/facet_search.rb', line 3 def @options end |
Instance Method Details
#facet_names ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/thinking_sphinx/facet_search.rb', line 27 def facet_names @facet_names ||= begin names = [:all_facets] ? facet_names_for_all_classes : facet_names_common_to_all_classes names.delete "class_crc" unless [:class_facet] names end end |
#for(hash = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/thinking_sphinx/facet_search.rb', line 16 def for(hash = {}) = {:with => {}}.merge() hash.each do |key, value| attrib = ThinkingSphinx::Facet.attribute_name_from_value(key, value) [:with][attrib] = key, value end ThinkingSphinx.search *(args + []) end |