class Daedal::Queries::FunctionScoreQuery

Public Instance Methods

to_hash() click to toggle source
# File lib/daedal/queries/function_score_query.rb, line 15
def to_hash
  {
    function_score: {
      query: build_query,
      functions: score_functions.map { |f| { filter: f[:filter].to_hash, weight: f[:weight] } },
      boost: boost || 1,
      score_mode: score_mode || "multiply"
    }
  }
end

Private Instance Methods

build_query() click to toggle source
# File lib/daedal/queries/function_score_query.rb, line 28
def build_query
  if filter
    { filtered: { query: query.to_hash, filter: filter.to_hash } }
  else
    query.to_hash
  end
end