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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, items, options = {}) ⇒ FacetField

Returns a new instance of FacetField.



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

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

#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)


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

def count?
  sort == 'count'
end

#index?Boolean

Returns:

  • (Boolean)


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

def index?
  sort == 'index'
end

#limitObject



38
39
40
# File 'lib/blacklight/solr/response/facets.rb', line 38

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

#offsetObject



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

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

#prefixObject



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

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

#sortObject



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

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