Class: Qiita::Elasticsearch::IntToken
- Includes:
- Concerns::RangeOperandIncludable
- Defined in:
- lib/qiita/elasticsearch/int_token.rb
Constant Summary collapse
- INT_PATTERN =
/\A\d+\z/
Constants included from Concerns::RangeOperandIncludable
Concerns::RangeOperandIncludable::RANGE_TERM_REGEXP
Instance Attribute Summary
Attributes inherited from Token
Instance Method Summary collapse
Methods included from Concerns::RangeOperandIncludable
#range_parameter, #range_query
Methods inherited from Token
#downcased?, #downcased_term, #filter?, #initialize, #must?, #must_not?, #negative?, #or?, #positive?, #proper_cased_term, #query?, #quoted?, #sort?, #to_s, #type?
Constructor Details
This class inherits a constructor from Qiita::Elasticsearch::Token
Instance Method Details
#to_hash ⇒ Hash
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/qiita/elasticsearch/int_token.rb', line 13 def to_hash if range_parameter && has_valid_range_query? { "range" => { proper_field_name => { range_parameter => range_query.to_i, }, }, } elsif has_valid_int_term? { "term" => { proper_field_name => @term.to_i, }, } else Nodes::NullNode.new.to_hash end end |