Skip to content

Commit

Permalink
feat(admin_ngram): query ngram fields for admin matching on autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Mar 18, 2019
1 parent 57d64f8 commit ccb9bc8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
18 changes: 9 additions & 9 deletions query/autocomplete_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,47 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'address:postcode:cutoff_frequency': 0.01,

'admin:country_a:analyzer': 'standard',
'admin:country_a:field': 'parent.country_a',
'admin:country_a:field': 'parent.country_a.ngram',
'admin:country_a:boost': 1000,
'admin:country_a:cutoff_frequency': 0.01,

'admin:country:analyzer': 'peliasAdmin',
'admin:country:field': 'parent.country',
'admin:country:field': 'parent.country.ngram',
'admin:country:boost': 800,
'admin:country:cutoff_frequency': 0.01,

'admin:region:analyzer': 'peliasAdmin',
'admin:region:field': 'parent.region',
'admin:region:field': 'parent.region.ngram',
'admin:region:boost': 600,
'admin:region:cutoff_frequency': 0.01,

'admin:region_a:analyzer': 'peliasAdmin',
'admin:region_a:field': 'parent.region_a',
'admin:region_a:field': 'parent.region_a.ngram',
'admin:region_a:boost': 600,
'admin:region_a:cutoff_frequency': 0.01,

'admin:county:analyzer': 'peliasAdmin',
'admin:county:field': 'parent.county',
'admin:county:field': 'parent.county.ngram',
'admin:county:boost': 400,
'admin:county:cutoff_frequency': 0.01,

'admin:localadmin:analyzer': 'peliasAdmin',
'admin:localadmin:field': 'parent.localadmin',
'admin:localadmin:field': 'parent.localadmin.ngram',
'admin:localadmin:boost': 200,
'admin:localadmin:cutoff_frequency': 0.01,

'admin:locality:analyzer': 'peliasAdmin',
'admin:locality:field': 'parent.locality',
'admin:locality:field': 'parent.locality.ngram',
'admin:locality:boost': 200,
'admin:locality:cutoff_frequency': 0.01,

'admin:neighbourhood:analyzer': 'peliasAdmin',
'admin:neighbourhood:field': 'parent.neighbourhood',
'admin:neighbourhood:field': 'parent.neighbourhood.ngram',
'admin:neighbourhood:boost': 200,
'admin:neighbourhood:cutoff_frequency': 0.01,

'admin:borough:analyzer': 'peliasAdmin',
'admin:borough:field': 'parent.borough',
'admin:borough:field': 'parent.borough.ngram',
'admin:borough:boost': 600,
'admin:borough:cutoff_frequency': 0.01,

Expand Down
2 changes: 1 addition & 1 deletion test/unit/fixture/autocomplete_boundary_country.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = {
}],
'filter': [{
'match': {
'parent.country_a': {
'parent.country_a.ngram': {
'analyzer': 'standard',
'query': 'ABC'
}
Expand Down
16 changes: 8 additions & 8 deletions test/unit/fixture/autocomplete_linguistic_with_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
'should': [
{
'match': {
'parent.country': {
'parent.country.ngram': {
'analyzer': 'peliasAdmin',
'boost': 800,
'cutoff_frequency': 0.01,
Expand All @@ -28,7 +28,7 @@ module.exports = {
},
{
'match': {
'parent.region': {
'parent.region.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -38,7 +38,7 @@ module.exports = {
},
{
'match': {
'parent.region_a': {
'parent.region_a.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -48,7 +48,7 @@ module.exports = {
},
{
'match': {
'parent.county': {
'parent.county.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 400,
Expand All @@ -58,7 +58,7 @@ module.exports = {
},
{
'match': {
'parent.borough': {
'parent.borough.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -68,7 +68,7 @@ module.exports = {
},
{
'match': {
'parent.localadmin': {
'parent.localadmin.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 200,
Expand All @@ -78,7 +78,7 @@ module.exports = {
},
{
'match': {
'parent.locality': {
'parent.locality.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 200,
Expand All @@ -88,7 +88,7 @@ module.exports = {
},
{
'match': {
'parent.neighbourhood': {
'parent.neighbourhood.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 200,
Expand Down
16 changes: 8 additions & 8 deletions test/unit/fixture/autocomplete_single_character_street.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
}
}, {
'match': {
'parent.country': {
'parent.country.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 800,
Expand All @@ -34,7 +34,7 @@ module.exports = {
}
}, {
'match': {
'parent.region': {
'parent.region.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -43,7 +43,7 @@ module.exports = {
}
}, {
'match': {
'parent.region_a': {
'parent.region_a.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -52,7 +52,7 @@ module.exports = {
}
}, {
'match': {
'parent.county': {
'parent.county.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 400,
Expand All @@ -61,7 +61,7 @@ module.exports = {
}
}, {
'match': {
'parent.borough': {
'parent.borough.ngram': {
'analyzer': 'peliasAdmin',
'cutoff_frequency': 0.01,
'boost': 600,
Expand All @@ -70,7 +70,7 @@ module.exports = {
}
}, {
'match': {
'parent.localadmin': {
'parent.localadmin.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 200,
Expand All @@ -79,7 +79,7 @@ module.exports = {
}
}, {
'match': {
'parent.locality': {
'parent.locality.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 200,
Expand All @@ -88,7 +88,7 @@ module.exports = {
}
}, {
'match': {
'parent.neighbourhood': {
'parent.neighbourhood.ngram': {
'query': 'laird',
'cutoff_frequency': 0.01,
'boost': 200,
Expand Down

0 comments on commit ccb9bc8

Please sign in to comment.