Class: AtlasEngine::AddressValidation::Es::DefaultQueryBuilder

Inherits:
QueryBuilder
  • Object
show all
Defined in:
app/models/atlas_engine/address_validation/es/default_query_builder.rb

Direct Known Subclasses

Cz::AddressValidation::Es::QueryBuilder

Instance Method Summary collapse

Methods inherited from QueryBuilder

for, #initialize

Constructor Details

This class inherits a constructor from AtlasEngine::AddressValidation::Es::QueryBuilder

Instance Method Details

#full_address_queryObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/atlas_engine/address_validation/es/default_query_builder.rb', line 9

def full_address_query
  clauses = [
    building_number_clause,
    street_clause,
    city_clause,
    zip_clause,
    province_clause,
  ].compact
  {
    "query" => {
      "bool" =>
        {
          "should" => clauses,
          "minimum_should_match" => [clauses.count - 2, 2].max,
        },
    },
  }
end