Class: Ddr::Index::QueryParams
- Inherits:
-
Object
- Object
- Ddr::Index::QueryParams
- Defined in:
- lib/ddr/index/query_params.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #fields ⇒ Object
- #filter_queries ⇒ Object
-
#initialize(query) ⇒ QueryParams
constructor
A new instance of QueryParams.
- #params ⇒ Object
- #q_param ⇒ Object
- #rows ⇒ Object
- #sort ⇒ Object
Constructor Details
#initialize(query) ⇒ QueryParams
Returns a new instance of QueryParams.
6 7 8 |
# File 'lib/ddr/index/query_params.rb', line 6 def initialize(query) @query = query end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
4 5 6 |
# File 'lib/ddr/index/query_params.rb', line 4 def query @query end |
Instance Method Details
#fields ⇒ Object
27 28 29 |
# File 'lib/ddr/index/query_params.rb', line 27 def fields query.fields.join(",") end |
#filter_queries ⇒ Object
23 24 25 |
# File 'lib/ddr/index/query_params.rb', line 23 def filter_queries query.filter_clauses.map(&:to_s) end |
#params ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ddr/index/query_params.rb', line 10 def params { q: q_param, fq: filter_queries, fl: fields, sort: sort, rows: rows, }.select { |k, v| v.present? } end |
#q_param ⇒ Object
19 20 21 |
# File 'lib/ddr/index/query_params.rb', line 19 def q_param query.q.to_s end |
#rows ⇒ Object
35 36 37 |
# File 'lib/ddr/index/query_params.rb', line 35 def rows query.rows end |
#sort ⇒ Object
31 32 33 |
# File 'lib/ddr/index/query_params.rb', line 31 def sort query.sort.join(",") end |