class Blacklight::Solr::Response::Facets::FacetField

represents a facet; which is a field and its values

Attributes

items[R]
missing[RW]
name[R]

Public Class Methods

new(name, items, options = {}) click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 34
def initialize name, items, options = {}
  @name = name
  @items = items
  @options = options
end

Public Instance Methods

count?() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 68
def count?
  sort == 'count'
end
data() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 60
def data
  @options[:data] || {}
end
index?() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 64
def index?
  sort == 'index'
end
limit() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 40
def limit
  @options[:limit] || solr_default_limit
end
offset() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 48
def offset
  @options[:offset] || solr_default_offset
end
prefix() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 52
def prefix
  @options[:prefix] || solr_default_prefix
end
sort() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 44
def sort
  @options[:sort] || solr_default_sort
end
type() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 56
def type
  @options[:type] || 'terms'
end

Private Instance Methods

solr_default_limit() click to toggle source

Per wiki.apache.org/solr/SimpleFacetParameters#facet.limit

# File lib/blacklight/solr/response/facets.rb, line 75
def solr_default_limit
  100
end
solr_default_offset() click to toggle source

Per wiki.apache.org/solr/SimpleFacetParameters#facet.offset

# File lib/blacklight/solr/response/facets.rb, line 89
def solr_default_offset
  0
end
solr_default_prefix() click to toggle source
# File lib/blacklight/solr/response/facets.rb, line 93
def solr_default_prefix
  nil
end
solr_default_sort() click to toggle source

Per wiki.apache.org/solr/SimpleFacetParameters#facet.sort

# File lib/blacklight/solr/response/facets.rb, line 80
def solr_default_sort
  if limit > 0
    'count'
  else
    'index'
  end
end