Module: Blacklight::Solr::Response::Params
- Included in:
- Blacklight::Solr::Response
- Defined in:
- lib/blacklight/solr/response/params.rb
Constant Summary collapse
- QUERY_PARAMETER_TO_JSON_PARAMETER_MAPPING =
{ q: :query, fq: :filter, start: :offset, rows: :limit, fl: :fields, sort: :sort }.freeze
Instance Method Summary collapse
- #facet_field_aggregation_options(facet_field_name) ⇒ Object
- #params ⇒ Object
- #rows ⇒ Object
- #sort ⇒ Object
- #start ⇒ Object
Instance Method Details
#facet_field_aggregation_options(facet_field_name) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/blacklight/solr/response/params.rb', line 30 def (facet_field_name) defaults = { sort: single_valued_param(:'facet.sort'), limit: single_valued_param(:'facet.limit')&.to_i || 100, offset: single_valued_param(:'facet.offset').to_i, prefix: single_valued_param(:'facet.prefix') } json_facet = json_params.dig('facet', facet_field_name)&.slice(:limit, :offset, :prefix, :sort)&.symbolize_keys || {} param_facet = { sort: single_valued_param(:"f.#{facet_field_name}.facet.sort"), limit: single_valued_param(:"f.#{facet_field_name}.facet.limit")&.to_i, offset: single_valued_param(:"f.#{facet_field_name}.facet.offset")&.to_i, prefix: single_valued_param(:"f.#{facet_field_name}.facet.prefix") }.compact = defaults.merge(json_facet).merge(param_facet) [:sort] ||= [:limit].positive? ? 'count' : 'index' end |
#params ⇒ Object
14 15 16 |
# File 'lib/blacklight/solr/response/params.rb', line 14 def params header['params'] || request_params end |
#rows ⇒ Object
22 23 24 |
# File 'lib/blacklight/solr/response/params.rb', line 22 def rows search_builder&.rows || single_valued_param(:rows).to_i end |
#sort ⇒ Object
26 27 28 |
# File 'lib/blacklight/solr/response/params.rb', line 26 def sort search_builder&.sort || single_valued_param(:sort) end |
#start ⇒ Object
18 19 20 |
# File 'lib/blacklight/solr/response/params.rb', line 18 def start search_builder&.start || single_valued_param(:start).to_i end |