Module: Workarea::Search::Facets

Extended by:
ActiveSupport::Concern
Included in:
CategoryBrowse, HelpSearch, ProductSearch
Defined in:
app/queries/workarea/search/facets.rb

Instance Method Summary collapse

Instance Method Details

#facetsObject



6
7
8
# File 'app/queries/workarea/search/facets.rb', line 6

def facets
  @facets ||= terms_facets + range_facets
end

#range_facetsObject



16
17
18
19
20
21
22
23
24
25
26
# File 'app/queries/workarea/search/facets.rb', line 16

def range_facets
  return [] if params[:range_facets].blank?

  params[:range_facets].keys.map do |range_facet|
    RangeFacet.new(
      self,
      range_facet,
      params[:range_facets].fetch(range_facet, [])
    )
  end
end

#terms_facetsObject



10
11
12
13
14
# File 'app/queries/workarea/search/facets.rb', line 10

def terms_facets
  Array(params[:terms_facets]).map do |term_facet|
    TermsFacet.new(self, term_facet)
  end
end