class Boolminot::Clauses::Compounds::Conjunction

Public Instance Methods

to_elasticsearch(options = {}) click to toggle source
# File lib/boolminot/clauses/compounds/conjunction.rb, line 11
def to_elasticsearch(options = {})
  bool = clauses.reduce({}) do |sections, clause|
    more_sections = clause.to_raw_bool(options.merge(added_to: sections)).fetch(:bool)
    sections.merge(more_sections) do |_, old_val, new_val|
      old_val + new_val
    end
  end

  { bool: bool }
end