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
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.
34 35 36 37 38 |
# File 'lib/blacklight/solr/response/facets.rb', line 34 def initialize name, items, = {} @name = name @items = items @options = end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
31 32 33 |
# File 'lib/blacklight/solr/response/facets.rb', line 31 def items @items end |
#missing ⇒ Object
Returns the value of attribute missing.
32 33 34 |
# File 'lib/blacklight/solr/response/facets.rb', line 32 def missing @missing end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/blacklight/solr/response/facets.rb', line 31 def name @name end |
Instance Method Details
#count? ⇒ Boolean
72 73 74 |
# File 'lib/blacklight/solr/response/facets.rb', line 72 def count? sort == 'count' end |
#data ⇒ Object
60 61 62 |
# File 'lib/blacklight/solr/response/facets.rb', line 60 def data @options[:data] || {} end |
#index? ⇒ Boolean
68 69 70 |
# File 'lib/blacklight/solr/response/facets.rb', line 68 def index? sort == 'index' end |
#limit ⇒ Object
40 41 42 |
# File 'lib/blacklight/solr/response/facets.rb', line 40 def limit @options[:limit] || solr_default_limit end |
#offset ⇒ Object
48 49 50 |
# File 'lib/blacklight/solr/response/facets.rb', line 48 def offset @options[:offset] || solr_default_offset end |
#prefix ⇒ Object
52 53 54 |
# File 'lib/blacklight/solr/response/facets.rb', line 52 def prefix @options[:prefix] || solr_default_prefix end |
#response ⇒ Object
64 65 66 |
# File 'lib/blacklight/solr/response/facets.rb', line 64 def response @options[:response] end |
#sort ⇒ Object
44 45 46 |
# File 'lib/blacklight/solr/response/facets.rb', line 44 def sort @options[:sort] || solr_default_sort end |
#type ⇒ Object
56 57 58 |
# File 'lib/blacklight/solr/response/facets.rb', line 56 def type @options[:type] || 'terms' end |