diff --git a/package.json b/package.json index 08549887..398ce8c8 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "pelias-labels": "1.5.1", "pelias-logger": "0.1.0", "pelias-model": "4.4.0", - "pelias-query": "8.11.0", + "pelias-query": "8.12.0", "pelias-text-analyzer": "1.7.0", "stats-lite": "2.0.3", "through2": "^2.0.3" diff --git a/sanitizer/_synthesize_analysis.js b/sanitizer/_synthesize_analysis.js index ab18b581..f26dfc6a 100644 --- a/sanitizer/_synthesize_analysis.js +++ b/sanitizer/_synthesize_analysis.js @@ -2,6 +2,7 @@ const _ = require('lodash'); const text_analyzer = require('pelias-text-analyzer'); const fields = { + 'venue': 'query', 'address': 'address', 'neighbourhood': 'neighbourhood', 'borough': 'borough', diff --git a/test/unit/fixture/structured_geocoding/fallback.json b/test/unit/fixture/structured_geocoding/fallback.json index a957b72c..cd12a864 100644 --- a/test/unit/fixture/structured_geocoding/fallback.json +++ b/test/unit/fixture/structured_geocoding/fallback.json @@ -6,6 +6,96 @@ "query": { "bool": { "should": [ + { + "bool": { + "_name": "fallback.venue", + "must": [ + { + "multi_match": { + "query": "query value", + "type": "phrase", + "fields": [ + "phrase.default", + "category" + ] + } + }, + { + "multi_match": { + "query": "neighbourhood value", + "type": "phrase", + "fields": [ + "parent.neighbourhood", + "parent.neighbourhood_a" + ] + } + }, + { + "multi_match": { + "query": "borough value", + "type": "phrase", + "fields": [ + "parent.borough", + "parent.borough_a" + ] + } + }, + { + "multi_match": { + "query": "city value", + "type": "phrase", + "fields": [ + "parent.locality", + "parent.locality_a", + "parent.localadmin", + "parent.localadmin_a" + ] + } + }, + { + "multi_match": { + "query": "county value", + "type": "phrase", + "fields": [ + "parent.county", + "parent.county_a", + "parent.macrocounty", + "parent.macrocounty_a" + ] + } + }, + { + "multi_match": { + "query": "state value", + "type": "phrase", + "fields": [ + "parent.region", + "parent.region_a", + "parent.macroregion", + "parent.macroregion_a" + ] + } + }, + { + "multi_match": { + "query": "country value", + "type": "phrase", + "fields": [ + "parent.country", + "parent.country_a", + "parent.dependency", + "parent.dependency_a" + ] + } + } + ], + "filter": { + "term": { + "layer": "venue" + } + } + } + }, { "bool": { "_name": "fallback.address", diff --git a/test/unit/sanitizer/_synthesize_analysis.js b/test/unit/sanitizer/_synthesize_analysis.js index dabacef8..97d49b2a 100644 --- a/test/unit/sanitizer/_synthesize_analysis.js +++ b/test/unit/sanitizer/_synthesize_analysis.js @@ -12,7 +12,7 @@ module.exports.tests.text_parser = function(test, common) { }}); const raw = { - query: ' \t query \t value \t ', + venue: ' \t venue \t value \t ', neighbourhood: ' \t neighbourhood \t value \t ', borough: ' \t borough \t value \t ', locality: ' \t locality \t value \t ', @@ -26,6 +26,7 @@ module.exports.tests.text_parser = function(test, common) { const expected_clean = { parsed_text: { + query: 'venue value', neighbourhood: 'neighbourhood value', borough: 'borough value', city: 'locality value', @@ -58,6 +59,7 @@ module.exports.tests.text_parser = function(test, common) { } const raw = { + venue: getInvalidValue(), address: getInvalidValue(), neighbourhood: getInvalidValue(), borough: getInvalidValue(), @@ -78,7 +80,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'venue, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end(); @@ -101,7 +103,7 @@ module.exports.tests.text_parser = function(test, common) { t.deepEquals(clean, expected_clean); t.deepEquals(messages.errors, ['at least one of the following fields is required: ' + - 'address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); + 'venue, address, neighbourhood, borough, locality, county, region, postalcode, country'], 'no errors'); t.deepEquals(messages.warnings, [], 'no warnings'); t.end();