Class: Blacklight::Solr::Response::Facets::FacetField
- Inherits:
-
Object
- Object
- Blacklight::Solr::Response::Facets::FacetField
- Defined in:
- lib/blacklight/solr/response/facets.rb
Overview
represents a facet; which is a field and its values
Direct Known Subclasses
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#missing ⇒ Object
Returns the value of attribute missing.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #count? ⇒ Boolean
- #data ⇒ Object
- #index? ⇒ Boolean
-
#initialize(name, items, options = {}) ⇒ FacetField
constructor
A new instance of FacetField.
- #limit ⇒ Object
- #offset ⇒ Object
- #prefix ⇒ Object
- #response ⇒ Object
- #sort ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(name, items, options = {}) ⇒ FacetField
Returns a new instance of FacetField.
35 36 37 38 39 |
# File 'lib/blacklight/solr/response/facets.rb', line 35 def initialize name, items, = {} @name = name @items = items @options = end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
32 33 34 |
# File 'lib/blacklight/solr/response/facets.rb', line 32 def items @items end |
#missing ⇒ Object
Returns the value of attribute missing.
33 34 35 |
# File 'lib/blacklight/solr/response/facets.rb', line 33 def missing @missing end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/blacklight/solr/response/facets.rb', line 32 def name @name end |
Instance Method Details
#count? ⇒ Boolean
73 74 75 |
# File 'lib/blacklight/solr/response/facets.rb', line 73 def count? sort == 'count' end |
#data ⇒ Object
61 62 63 |
# File 'lib/blacklight/solr/response/facets.rb', line 61 def data @options[:data] || {} end |
#index? ⇒ Boolean
69 70 71 |
# File 'lib/blacklight/solr/response/facets.rb', line 69 def index? sort == 'index' end |
#limit ⇒ Object
41 42 43 |
# File 'lib/blacklight/solr/response/facets.rb', line 41 def limit @options[:limit] || solr_default_limit end |
#offset ⇒ Object
49 50 51 |
# File 'lib/blacklight/solr/response/facets.rb', line 49 def offset @options[:offset] || solr_default_offset end |
#prefix ⇒ Object
53 54 55 |
# File 'lib/blacklight/solr/response/facets.rb', line 53 def prefix @options[:prefix] || solr_default_prefix end |
#response ⇒ Object
65 66 67 |
# File 'lib/blacklight/solr/response/facets.rb', line 65 def response @options[:response] end |
#sort ⇒ Object
45 46 47 |
# File 'lib/blacklight/solr/response/facets.rb', line 45 def sort @options[:sort] || solr_default_sort end |
#type ⇒ Object
57 58 59 |
# File 'lib/blacklight/solr/response/facets.rb', line 57 def type @options[:type] || 'terms' end |