Class: AtlasEngine::Gb::AddressValidation::Es::QueryBuilder

Inherits:
AddressValidation::Es::QueryBuilder show all
Extended by:
T::Sig
Defined in:
app/countries/atlas_engine/gb/address_validation/es/query_builder.rb

Instance Method Summary collapse

Methods inherited from AddressValidation::Es::QueryBuilder

for

Constructor Details

#initialize(address, parsings, profile) ⇒ QueryBuilder

Returns a new instance of QueryBuilder.



18
19
20
21
22
23
24
25
26
# File 'app/countries/atlas_engine/gb/address_validation/es/query_builder.rb', line 18

def initialize(address, parsings, profile)
  super

  @parsings = T.let(
    AtlasEngine::Gb::ValidationTranscriber::FullAddressParser
      .new(address: address).parse,
    T::Array[ValidationTranscriber::ParsedAddress],
  )
end

Instance Method Details

#full_address_queryObject



29
30
31
32
33
34
35
36
37
# File 'app/countries/atlas_engine/gb/address_validation/es/query_builder.rb', line 29

def full_address_query
  {
    "query" => {
      "dis_max" => {
        "queries" => @parsings.map { |parsing| query_for_parsing(parsing) },
      },
    },
  }
end