Class: Qiita::Elasticsearch::Nodes::TokenNode

Inherits:
Object
  • Object
show all
Defined in:
lib/qiita/elasticsearch/nodes/token_node.rb

Instance Method Summary collapse

Constructor Details

#initialize(token, matchable_fields: nil) ⇒ TokenNode

Returns a new instance of TokenNode.

Parameters:



10
11
12
13
# File 'lib/qiita/elasticsearch/nodes/token_node.rb', line 10

def initialize(token, matchable_fields: nil)
  @matchable_fields = matchable_fields
  @token = token
end

Instance Method Details

#to_hashObject



15
16
17
18
19
20
21
# File 'lib/qiita/elasticsearch/nodes/token_node.rb', line 15

def to_hash
  if @token.field_name
    FilterQueryNode.new(@token).to_hash
  else
    MatchQueryNode.new(@token, matchable_fields: @matchable_fields).to_hash
  end
end