Skip to content

Commit

Permalink
Merge pull request #122 from pelias/allow-specifying-street-analyzer
Browse files Browse the repository at this point in the history
Allow specifying analyzer for `address_parts.street` field
  • Loading branch information
orangejulius authored Jun 23, 2020
2 parents 133e7b7 + cb818e6 commit cee0da3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
20 changes: 16 additions & 4 deletions layout/AddressesUsingIdsQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ function createAddressShould(vs) {
_name: 'fallback.address',
must: [
match_phrase('address_parts.number', vs.var('input:housenumber')),
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
filter: {
term: {
Expand All @@ -32,7 +35,10 @@ function createUnitAndAddressShould(vs) {
must: [
match_phrase('address_parts.unit', vs.var('input:unit')),
match_phrase('address_parts.number', vs.var('input:housenumber')),
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
filter: {
term: {
Expand All @@ -56,7 +62,10 @@ function createPostcodeAndAddressShould(vs) {
must: [
match_phrase('address_parts.zip', vs.var('input:postcode')),
match_phrase('address_parts.number', vs.var('input:housenumber')),
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
filter: {
term: {
Expand All @@ -78,7 +87,10 @@ function createStreetShould(vs) {
bool: {
_name: 'fallback.street',
must: [
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
filter: {
term: {
Expand Down
15 changes: 12 additions & 3 deletions layout/FallbackQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ function addUnitAndHouseNumberAndStreet(vs) {
must: [
match_phrase('address_parts.unit', vs.var('input:unit')),
match_phrase('address_parts.number', vs.var('input:housenumber')),
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
should: [],
filter: {
Expand Down Expand Up @@ -265,7 +268,10 @@ function addHouseNumberAndStreet(vs) {
_name: 'fallback.address',
must: [
match_phrase('address_parts.number', vs.var('input:housenumber')),
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
should: [],
filter: {
Expand Down Expand Up @@ -297,7 +303,10 @@ function addStreet(vs) {
bool: {
_name: 'fallback.street',
must: [
match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') })
match_phrase('address_parts.street', vs.var('input:street'), {
slop: vs.var('address:street:slop'),
analyzer: vs.var('address:street:analyzer')
})
],
should: [],
filter: {
Expand Down

0 comments on commit cee0da3

Please sign in to comment.