Class: Qiita::Elasticsearch::DateToken::RelativeDateExpression
- Inherits:
-
BaseDateExpression
- Object
- BaseDateExpression
- Qiita::Elasticsearch::DateToken::RelativeDateExpression
- Defined in:
- lib/qiita/elasticsearch/date_token.rb
Constant Summary collapse
- PATTERN =
Note:
Matches to “30d” and “30days”
/\A - (?<digit>\d+) (?<type>d|y|day|days|year|years) \z/x
Constants inherited from BaseDateExpression
BaseDateExpression::FIELD_NAMES_TABLE
Instance Method Summary collapse
Methods inherited from BaseDateExpression
#converted_field_name, #initialize, #match
Constructor Details
This class inherits a constructor from Qiita::Elasticsearch::DateToken::BaseDateExpression
Instance Method Details
#to_hash ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/qiita/elasticsearch/date_token.rb', line 108 def to_hash if @token.range_parameter { "range" => { converted_field_name => { @token.range_parameter => relative_range_with_hours, }, }, } else Nodes::NullNode.new.to_hash end end |