Module: Esse::Search::Query::DSL
- Included in:
- Esse::Search::Query
- Defined in:
- lib/esse/search/query/dsl.rb
Instance Method Summary collapse
Instance Method Details
#limit(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/esse/search/query/dsl.rb', line 7 def limit(value) return self if value.to_i <= 0 mutate do |defn| defn.delete(:size) if (body = defn[:body]).is_a?(Hash) body[body.key?('size') ? 'size' : :size] = value.to_i else defn.update(size: value.to_i) end end end |
#limit_value ⇒ Object
33 34 35 |
# File 'lib/esse/search/query/dsl.rb', line 33 def limit_value raw_limit_value || 10 end |
#offset(value) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/esse/search/query/dsl.rb', line 20 def offset(value) return self if value.to_i < 0 mutate do |defn| defn.delete(:from) if (body = defn[:body]).is_a?(Hash) body[body.key?('from') ? 'from' : :from] = value.to_i else defn.update(from: value.to_i) end end end |
#offset_value ⇒ Object
37 38 39 |
# File 'lib/esse/search/query/dsl.rb', line 37 def offset_value raw_offset_value || 0 end |