Class: Qiita::Elasticsearch::MatchableToken
- Defined in:
- lib/qiita/elasticsearch/matchable_token.rb
Instance Attribute Summary collapse
-
#matchable_fields ⇒ Object
writeonly
Sets the attribute matchable_fields.
Attributes inherited from Token
Instance Method Summary collapse
Methods inherited from Token
#downcased?, #downcased_term, #filter?, #ignorable?, #initialize, #must?, #must_not?, #negative?, #or?, #positive?, #proper_cased_term, #quoted?, #to_s
Constructor Details
This class inherits a constructor from Qiita::Elasticsearch::Token
Instance Attribute Details
#matchable_fields=(value) ⇒ Object (writeonly)
Sets the attribute matchable_fields
6 7 8 |
# File 'lib/qiita/elasticsearch/matchable_token.rb', line 6 def matchable_fields=(value) @matchable_fields = value end |
Instance Method Details
#to_hash ⇒ Hash
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/qiita/elasticsearch/matchable_token.rb', line 9 def to_hash if @matchable_fields.nil? { quoted? ? "match_phrase" : "match" => { "_all" => @term, } } else hash = { "multi_match" => { "fields" => @matchable_fields, "query" => @term, }, } hash["multi_match"]["type"] = "phrase" if quoted? hash end end |