Class: ThinkingSphinx::FacetSearch
- Inherits:
-
Hash
- Object
- Hash
- ThinkingSphinx::FacetSearch
- Defined in:
- lib/thinking_sphinx/facet_search.rb
Instance Attribute Summary (collapse)
-
- (Object) args
Returns the value of attribute args.
-
- (Object) options
Returns the value of attribute options.
Instance Method Summary (collapse)
- - (Object) facet_names
- - (Object) for(hash = {})
-
- (FacetSearch) initialize(*args)
constructor
A new instance of FacetSearch.
Constructor Details
- (FacetSearch) initialize(*args)
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
- (Object) args
Returns the value of attribute args
3 4 5 |
# File 'lib/thinking_sphinx/facet_search.rb', line 3 def args @args end |
- (Object) options
Returns the value of attribute options
3 4 5 |
# File 'lib/thinking_sphinx/facet_search.rb', line 3 def @options end |
Instance Method Details
- (Object) facet_names
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_facet unless [:class_facet] names end end |
- (Object) for(hash = {})
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 |