Class: ElasticQuery::RescoreQuery

Inherits:
Query show all
Defined in:
lib/elastic_query/rescore_query.rb

Instance Attribute Summary collapse

Attributes inherited from Query

#query

Instance Method Summary collapse

Constructor Details

#initialize(query, rescore_query, options = {}) ⇒ RescoreQuery

Returns a new instance of RescoreQuery.



5
6
7
8
9
# File 'lib/elastic_query/rescore_query.rb', line 5

def initialize(query, rescore_query, options = {})
  @options = options
  @rescore_query = rescore_query
  super(query)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/elastic_query/rescore_query.rb', line 3

def options
  @options
end

#rescore_queryObject (readonly)

Returns the value of attribute rescore_query.



3
4
5
# File 'lib/elastic_query/rescore_query.rb', line 3

def rescore_query
  @rescore_query
end

Instance Method Details

#to_hashObject



11
12
13
14
15
16
17
18
# File 'lib/elastic_query/rescore_query.rb', line 11

def to_hash
  {
    query: query.to_hash,
    rescore: {
      rescore_query: rescore_query.to_hash,
    }.merge(options)
  }
end