diff --git a/middleware/trimByGranularityComponent.js b/middleware/trimByGranularityStructured.js similarity index 100% rename from middleware/trimByGranularityComponent.js rename to middleware/trimByGranularityStructured.js diff --git a/query/component_geocoding.js b/query/structured_geocoding.js similarity index 78% rename from query/component_geocoding.js rename to query/structured_geocoding.js index c212c848..2d8a7ea2 100644 --- a/query/component_geocoding.js +++ b/query/structured_geocoding.js @@ -6,21 +6,21 @@ var peliasQuery = require('pelias-query'), //------------------------------ // general-purpose search query //------------------------------ -var componentQuery = new peliasQuery.layout.ComponentFallbackQuery(); +var structuredQuery = new peliasQuery.layout.ComponentFallbackQuery(); // scoring boost -componentQuery.score( peliasQuery.view.focus_only_function( peliasQuery.view.phrase ) ); -componentQuery.score( peliasQuery.view.popularity_only_function ); -componentQuery.score( peliasQuery.view.population_only_function ); +structuredQuery.score( peliasQuery.view.focus_only_function( peliasQuery.view.phrase ) ); +structuredQuery.score( peliasQuery.view.popularity_only_function ); +structuredQuery.score( peliasQuery.view.population_only_function ); // -------------------------------- // non-scoring hard filters -componentQuery.filter( peliasQuery.view.boundary_country ); -componentQuery.filter( peliasQuery.view.boundary_circle ); -componentQuery.filter( peliasQuery.view.boundary_rect ); -componentQuery.filter( peliasQuery.view.sources ); -componentQuery.filter( peliasQuery.view.layers ); -componentQuery.filter( peliasQuery.view.categories ); +structuredQuery.filter( peliasQuery.view.boundary_country ); +structuredQuery.filter( peliasQuery.view.boundary_circle ); +structuredQuery.filter( peliasQuery.view.boundary_rect ); +structuredQuery.filter( peliasQuery.view.sources ); +structuredQuery.filter( peliasQuery.view.layers ); +structuredQuery.filter( peliasQuery.view.categories ); // -------------------------------- /** @@ -105,7 +105,7 @@ function generateQuery( clean ){ function getQuery(vs) { return { type: 'fallback', - body: componentQuery.render(vs) + body: structuredQuery.render(vs) }; } diff --git a/routes/v1.js b/routes/v1.js index a1c71fb1..20fb1194 100644 --- a/routes/v1.js +++ b/routes/v1.js @@ -8,7 +8,7 @@ var sanitizers = { place: require('../sanitizer/place'), search: require('../sanitizer/search'), search_fallback: require('../sanitizer/search_fallback'), - component_geocoding: require('../sanitizer/component_geocoding'), + structured_geocoding: require('../sanitizer/structured_geocoding'), reverse: require('../sanitizer/reverse'), nearby: require('../sanitizer/nearby') }; @@ -30,14 +30,14 @@ var controllers = { var queries = { libpostal: require('../query/search'), fallback_to_old_prod: require('../query/search_original'), - component_geocoding: require('../query/component_geocoding') + structured_geocoding: require('../query/structured_geocoding') }; /** ----------------------- controllers ----------------------- **/ var postProc = { trimByGranularity: require('../middleware/trimByGranularity'), - trimByGranularityComponent: require('../middleware/trimByGranularityComponent'), + trimByGranularityStructured: require('../middleware/trimByGranularityStructured'), distances: require('../middleware/distance'), confidenceScores: require('../middleware/confidenceScore'), confidenceScoresFallback: require('../middleware/confidenceScoreFallback'), @@ -95,11 +95,11 @@ function addRoutes(app, peliasConfig) { postProc.geocodeJSON(peliasConfig, base), postProc.sendJSON ]), - component: createRouter([ - sanitizers.component_geocoding.middleware, + structured: createRouter([ + sanitizers.structured_geocoding.middleware, middleware.calcSize(), - controllers.search(peliasConfig, undefined, queries.component_geocoding), - postProc.trimByGranularityComponent(), + controllers.search(peliasConfig, undefined, queries.structured_geocoding), + postProc.trimByGranularityStructured(), postProc.distances('focus.point.'), postProc.confidenceScores(peliasConfig), postProc.confidenceScoresFallback(), @@ -193,7 +193,7 @@ function addRoutes(app, peliasConfig) { app.get ( base + 'autocomplete', routers.autocomplete ); app.get ( base + 'search', routers.search ); app.post( base + 'search', routers.search ); - app.get ( base + 'beta/component', routers.component ); + app.get ( base + 'search/structured', routers.structured ); app.get ( base + 'reverse', routers.reverse ); app.get ( base + 'nearby', routers.nearby ); diff --git a/sanitizer/component_geocoding.js b/sanitizer/structured_geocoding.js similarity index 100% rename from sanitizer/component_geocoding.js rename to sanitizer/structured_geocoding.js diff --git a/test/unit/fixture/component_geocoding/boundary_country.json b/test/unit/fixture/structured_geocoding/boundary_country.json similarity index 100% rename from test/unit/fixture/component_geocoding/boundary_country.json rename to test/unit/fixture/structured_geocoding/boundary_country.json diff --git a/test/unit/fixture/component_geocoding/fallback.json b/test/unit/fixture/structured_geocoding/fallback.json similarity index 100% rename from test/unit/fixture/component_geocoding/fallback.json rename to test/unit/fixture/structured_geocoding/fallback.json diff --git a/test/unit/fixture/component_geocoding/linguistic_bbox.json b/test/unit/fixture/structured_geocoding/linguistic_bbox.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_bbox.json rename to test/unit/fixture/structured_geocoding/linguistic_bbox.json diff --git a/test/unit/fixture/component_geocoding/linguistic_focus.json b/test/unit/fixture/structured_geocoding/linguistic_focus.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_focus.json rename to test/unit/fixture/structured_geocoding/linguistic_focus.json diff --git a/test/unit/fixture/component_geocoding/linguistic_focus_bbox.json b/test/unit/fixture/structured_geocoding/linguistic_focus_bbox.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_focus_bbox.json rename to test/unit/fixture/structured_geocoding/linguistic_focus_bbox.json diff --git a/test/unit/fixture/component_geocoding/linguistic_focus_null_island.json b/test/unit/fixture/structured_geocoding/linguistic_focus_null_island.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_focus_null_island.json rename to test/unit/fixture/structured_geocoding/linguistic_focus_null_island.json diff --git a/test/unit/fixture/component_geocoding/linguistic_only.json b/test/unit/fixture/structured_geocoding/linguistic_only.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_only.json rename to test/unit/fixture/structured_geocoding/linguistic_only.json diff --git a/test/unit/fixture/component_geocoding/linguistic_viewport.json b/test/unit/fixture/structured_geocoding/linguistic_viewport.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_viewport.json rename to test/unit/fixture/structured_geocoding/linguistic_viewport.json diff --git a/test/unit/fixture/component_geocoding/linguistic_viewport_min_diagonal.json b/test/unit/fixture/structured_geocoding/linguistic_viewport_min_diagonal.json similarity index 100% rename from test/unit/fixture/component_geocoding/linguistic_viewport_min_diagonal.json rename to test/unit/fixture/structured_geocoding/linguistic_viewport_min_diagonal.json diff --git a/test/unit/fixture/component_geocoding/with_source_filtering.json b/test/unit/fixture/structured_geocoding/with_source_filtering.json similarity index 100% rename from test/unit/fixture/component_geocoding/with_source_filtering.json rename to test/unit/fixture/structured_geocoding/with_source_filtering.json diff --git a/test/unit/middleware/trimByGranularityComponent.js b/test/unit/middleware/trimByGranularityStructured.js similarity index 99% rename from test/unit/middleware/trimByGranularityComponent.js rename to test/unit/middleware/trimByGranularityStructured.js index d90a3803..8e5fe498 100644 --- a/test/unit/middleware/trimByGranularityComponent.js +++ b/test/unit/middleware/trimByGranularityStructured.js @@ -1,4 +1,4 @@ -var trimByGranularity = require('../../../middleware/trimByGranularityComponent')(); +var trimByGranularity = require('../../../middleware/trimByGranularityStructured')(); module.exports.tests = {}; diff --git a/test/unit/query/component_geocoding.js b/test/unit/query/structured_geocoding.js similarity index 86% rename from test/unit/query/component_geocoding.js rename to test/unit/query/structured_geocoding.js index 42e4736d..fc5f211a 100644 --- a/test/unit/query/component_geocoding.js +++ b/test/unit/query/structured_geocoding.js @@ -1,4 +1,4 @@ -var generate = require('../../../query/component_geocoding'); +var generate = require('../../../query/structured_geocoding'); var fs = require('fs'); module.exports.tests = {}; @@ -28,7 +28,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_focus_bbox'); + var expected = require('../fixture/structured_geocoding/linguistic_focus_bbox'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_focus_bbox'); @@ -51,7 +51,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_bbox'); + var expected = require('../fixture/structured_geocoding/linguistic_bbox'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_bbox'); @@ -69,7 +69,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_only'); + var expected = require('../fixture/structured_geocoding/linguistic_only'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_only'); @@ -88,7 +88,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_focus'); + var expected = require('../fixture/structured_geocoding/linguistic_focus'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_focus'); @@ -110,7 +110,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_viewport'); + var expected = require('../fixture/structured_geocoding/linguistic_viewport'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_viewport'); @@ -134,7 +134,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_viewport_min_diagonal'); + var expected = require('../fixture/structured_geocoding/linguistic_viewport_min_diagonal'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'valid search query'); @@ -153,7 +153,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/linguistic_focus_null_island'); + var expected = require('../fixture/structured_geocoding/linguistic_focus_null_island'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search_linguistic_focus_null_island'); @@ -180,7 +180,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse(JSON.stringify(query)); - var expected = require('../fixture/component_geocoding/fallback'); + var expected = require('../fixture/structured_geocoding/fallback'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'fallbackQuery'); @@ -200,7 +200,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/boundary_country'); + var expected = require('../fixture/structured_geocoding/boundary_country'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search: valid boundary.country query'); @@ -218,7 +218,7 @@ module.exports.tests.query = function(test, common) { var query = generate(clean); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/component_geocoding/with_source_filtering'); + var expected = require('../fixture/structured_geocoding/with_source_filtering'); t.deepEqual(compiled.type, 'fallback', 'query type set'); t.deepEqual(compiled.body, expected, 'search: valid search query with source filtering'); @@ -229,7 +229,7 @@ module.exports.tests.query = function(test, common) { module.exports.all = function (tape, common) { function test(name, testFunction) { - return tape('component_geocoding query ' + name, testFunction); + return tape('structured_geocoding query ' + name, testFunction); } for( var testCase in module.exports.tests ){ diff --git a/test/unit/run.js b/test/unit/run.js index 6ef7d417..a3109585 100644 --- a/test/unit/run.js +++ b/test/unit/run.js @@ -30,15 +30,15 @@ var tests = [ require('./middleware/sendJSON'), require('./middleware/normalizeParentIds'), require('./middleware/trimByGranularity'), - require('./middleware/trimByGranularityComponent'), + require('./middleware/trimByGranularityStructured'), require('./query/autocomplete'), require('./query/autocomplete_defaults'), - require('./query/component_geocoding'), require('./query/search_defaults'), require('./query/reverse_defaults'), require('./query/reverse'), require('./query/search'), require('./query/search_original'), + require('./query/structured_geocoding'), require('./query/text_parser'), require('./sanitizer/_boundary_country'), require('./sanitizer/_flag_bool'), @@ -61,7 +61,7 @@ var tests = [ require('./sanitizer/nearby'), require('./src/backend'), require('./sanitizer/autocomplete'), - require('./sanitizer/component_geocoding'), + require('./sanitizer/structured_geocoding'), require('./sanitizer/place'), require('./sanitizer/reverse'), require('./sanitizer/sanitizeAll'), diff --git a/test/unit/sanitizer/component_geocoding.js b/test/unit/sanitizer/structured_geocoding.js similarity index 96% rename from test/unit/sanitizer/component_geocoding.js rename to test/unit/sanitizer/structured_geocoding.js index 6477b738..3d6c606e 100644 --- a/test/unit/sanitizer/component_geocoding.js +++ b/test/unit/sanitizer/structured_geocoding.js @@ -8,7 +8,7 @@ module.exports.tests.sanitize = function(test, common) { // rather than re-verify the functionality of all the sanitizers, this test just verifies that they // were all called correctly - var search = proxyquire('../../../sanitizer/component_geocoding', { + var search = proxyquire('../../../sanitizer/structured_geocoding', { '../sanitizer/_deprecate_quattroshapes': function() { called_sanitizers.push('_deprecate_quattroshapes'); return { errors: [], warnings: [] }; @@ -109,7 +109,7 @@ module.exports.tests.sanitize = function(test, common) { module.exports.all = function (tape, common) { function test(name, testFunction) { - return tape('SANTIZE /component ' + name, testFunction); + return tape('SANTIZE /structured ' + name, testFunction); } for( var testCase in module.exports.tests ){