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.



35
36
37
38
39
# File 'lib/blacklight/solr/response/facets.rb', line 35

def initialize name, items, options = {}
  @name = name
  @items = items
  @options = options
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



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

def items
  @items
end

#missingObject

Returns the value of attribute missing.



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

def missing
  @missing
end

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

Returns:

  • (Boolean)


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

def count?
  sort == 'count'
end

#dataObject



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

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

#index?Boolean

Returns:

  • (Boolean)


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

def index?
  sort == 'index'
end

#limitObject



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

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

#offsetObject



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

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

#prefixObject



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

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

#responseObject



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

def response
  @options[:response]
end

#sortObject



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

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

#typeObject



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

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