Class: Blacklight::Solr::Response::Facets::FacetField

Inherits:
Object
  • Object
show all
Defined in:
lib/blacklight/solr/response/facets.rb

Overview

represents a facet; which is a field and its values

Direct Known Subclasses

NullFacetField

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {}
  @name = name
  @items = items
  @options = options
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



31
32
33
# File 'lib/blacklight/solr/response/facets.rb', line 31

def items
  @items
end

#missingObject

Returns the value of attribute missing.



32
33
34
# File 'lib/blacklight/solr/response/facets.rb', line 32

def missing
  @missing
end

#nameObject (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

Returns:

  • (Boolean)


72
73
74
# File 'lib/blacklight/solr/response/facets.rb', line 72

def count?
  sort == 'count'
end

#dataObject



60
61
62
# File 'lib/blacklight/solr/response/facets.rb', line 60

def data
  @options[:data] || {}
end

#index?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/blacklight/solr/response/facets.rb', line 68

def index?
  sort == 'index'
end

#limitObject



40
41
42
# File 'lib/blacklight/solr/response/facets.rb', line 40

def limit
  @options[:limit] || solr_default_limit
end

#offsetObject



48
49
50
# File 'lib/blacklight/solr/response/facets.rb', line 48

def offset
  @options[:offset] || solr_default_offset
end

#prefixObject



52
53
54
# File 'lib/blacklight/solr/response/facets.rb', line 52

def prefix
  @options[:prefix] || solr_default_prefix
end

#responseObject



64
65
66
# File 'lib/blacklight/solr/response/facets.rb', line 64

def response
  @options[:response]
end

#sortObject



44
45
46
# File 'lib/blacklight/solr/response/facets.rb', line 44

def sort
  @options[:sort] || solr_default_sort
end

#typeObject



56
57
58
# File 'lib/blacklight/solr/response/facets.rb', line 56

def type
  @options[:type] || 'terms'
end