From aa3e764e49a76cb6d8f9fb2466aee42bf7e98b8f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 29 Mar 2016 14:41:44 +0200 Subject: [PATCH] update analyzers to work with https://github.com/pelias/schema/pull/109 --- query/autocomplete_defaults.js | 6 +++--- query/reverse_defaults.js | 2 +- query/search_defaults.js | 2 +- .../autocomplete_linguistic_final_token.js | 6 +++--- .../fixture/autocomplete_linguistic_focus.js | 8 ++++---- ...utocomplete_linguistic_focus_null_island.js | 8 ++++---- .../autocomplete_linguistic_multiple_tokens.js | 10 +++++----- .../fixture/autocomplete_linguistic_only.js | 6 +++--- .../autocomplete_linguistic_with_admin.js | 8 ++++---- test/unit/fixture/search_boundary_country.js | 2 +- test/unit/fixture/search_full_address.js | 2 +- test/unit/fixture/search_linguistic_bbox.js | 2 +- test/unit/fixture/search_linguistic_focus.js | 2 +- .../fixture/search_linguistic_focus_bbox.js | 2 +- .../search_linguistic_focus_null_island.js | 2 +- test/unit/fixture/search_linguistic_only.js | 2 +- .../unit/fixture/search_linguistic_viewport.js | 2 +- .../search_linguistic_viewport_min_diagonal.js | 2 +- test/unit/fixture/search_partial_address.js | 2 +- test/unit/fixture/search_regions_address.js | 2 +- test/unit/query/autocomplete.js | 18 +++++++++--------- 21 files changed, 48 insertions(+), 48 deletions(-) diff --git a/query/autocomplete_defaults.js b/query/autocomplete_defaults.js index ba52a049..da0791ef 100644 --- a/query/autocomplete_defaults.js +++ b/query/autocomplete_defaults.js @@ -20,12 +20,12 @@ module.exports = _.merge({}, peliasQuery.defaults, { 'boundary:rect:type': 'indexed', 'boundary:rect:_cache': true, - 'ngram:analyzer': 'peliasPhrase', + 'ngram:analyzer': 'peliasQueryPartialToken', 'ngram:field': 'name.default', 'ngram:boost': 100, - 'phrase:analyzer': 'peliasPhrase', - 'phrase:field': 'phrase.default', + 'phrase:analyzer': 'peliasQueryFullToken', + 'phrase:field': 'name.default', 'phrase:boost': 1, 'phrase:slop': 2, diff --git a/query/reverse_defaults.js b/query/reverse_defaults.js index 306efaac..06ad6400 100644 --- a/query/reverse_defaults.js +++ b/query/reverse_defaults.js @@ -20,7 +20,7 @@ module.exports = _.merge({}, peliasQuery.defaults, { 'boundary:rect:type': 'indexed', 'boundary:rect:_cache': true, - 'ngram:analyzer': 'peliasOneEdgeGram', + 'ngram:analyzer': 'peliasQueryPartialToken', 'ngram:field': 'name.default', 'ngram:boost': 1, diff --git a/query/search_defaults.js b/query/search_defaults.js index ea0dc87f..3c26f4dc 100644 --- a/query/search_defaults.js +++ b/query/search_defaults.js @@ -20,7 +20,7 @@ module.exports = _.merge({}, peliasQuery.defaults, { 'boundary:rect:type': 'indexed', 'boundary:rect:_cache': true, - 'ngram:analyzer': 'peliasOneEdgeGram', + 'ngram:analyzer': 'peliasQueryPartialToken', 'ngram:field': 'name.default', 'ngram:boost': 1, diff --git a/test/unit/fixture/autocomplete_linguistic_final_token.js b/test/unit/fixture/autocomplete_linguistic_final_token.js index fbe80052..e100206b 100644 --- a/test/unit/fixture/autocomplete_linguistic_final_token.js +++ b/test/unit/fixture/autocomplete_linguistic_final_token.js @@ -7,7 +7,7 @@ module.exports = { 'must': [{ 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one', 'type': 'phrase', @@ -20,7 +20,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one', 'type': 'phrase', @@ -45,7 +45,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one', 'type': 'phrase', diff --git a/test/unit/fixture/autocomplete_linguistic_focus.js b/test/unit/fixture/autocomplete_linguistic_focus.js index 4f722b84..bcb18d0d 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus.js +++ b/test/unit/fixture/autocomplete_linguistic_focus.js @@ -7,7 +7,7 @@ module.exports = { 'must': [{ 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -20,7 +20,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -64,7 +64,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -89,7 +89,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', diff --git a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js index d9c04fd1..65a3146d 100644 --- a/test/unit/fixture/autocomplete_linguistic_focus_null_island.js +++ b/test/unit/fixture/autocomplete_linguistic_focus_null_island.js @@ -7,7 +7,7 @@ module.exports = { 'must': [{ 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -20,7 +20,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -64,7 +64,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -89,7 +89,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', diff --git a/test/unit/fixture/autocomplete_linguistic_multiple_tokens.js b/test/unit/fixture/autocomplete_linguistic_multiple_tokens.js index 9018fdab..db6c4fc4 100644 --- a/test/unit/fixture/autocomplete_linguistic_multiple_tokens.js +++ b/test/unit/fixture/autocomplete_linguistic_multiple_tokens.js @@ -6,8 +6,8 @@ module.exports = { 'bool': { 'must': [{ 'match': { - 'phrase.default': { - 'analyzer': 'peliasPhrase', + 'name.default': { + 'analyzer': 'peliasQueryFullToken', 'type': 'phrase', 'boost': 1, 'slop': 2, @@ -18,7 +18,7 @@ module.exports = { { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'three', 'type': 'phrase', @@ -31,7 +31,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one two three', 'type': 'phrase', @@ -56,7 +56,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one two three', 'type': 'phrase', diff --git a/test/unit/fixture/autocomplete_linguistic_only.js b/test/unit/fixture/autocomplete_linguistic_only.js index 24b89ad9..e4fe20ee 100644 --- a/test/unit/fixture/autocomplete_linguistic_only.js +++ b/test/unit/fixture/autocomplete_linguistic_only.js @@ -7,7 +7,7 @@ module.exports = { 'must': [{ 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -20,7 +20,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', @@ -45,7 +45,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'test', 'type': 'phrase', diff --git a/test/unit/fixture/autocomplete_linguistic_with_admin.js b/test/unit/fixture/autocomplete_linguistic_with_admin.js index 245f6451..59e77c0c 100644 --- a/test/unit/fixture/autocomplete_linguistic_with_admin.js +++ b/test/unit/fixture/autocomplete_linguistic_with_admin.js @@ -7,8 +7,8 @@ module.exports = { 'must': [ { 'match': { - 'phrase.default': { - 'analyzer': 'peliasPhrase', + 'name.default': { + 'analyzer': 'peliasQueryFullToken', 'type': 'phrase', 'boost': 1, 'slop': 2, @@ -86,7 +86,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one two', 'type': 'phrase', @@ -114,7 +114,7 @@ module.exports = { 'query': { 'match': { 'name.default': { - 'analyzer': 'peliasPhrase', + 'analyzer': 'peliasQueryPartialToken', 'boost': 100, 'query': 'one two', 'type': 'phrase', diff --git a/test/unit/fixture/search_boundary_country.js b/test/unit/fixture/search_boundary_country.js index 4bf45315..b84dd0e9 100644 --- a/test/unit/fixture/search_boundary_country.js +++ b/test/unit/fixture/search_boundary_country.js @@ -18,7 +18,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } } diff --git a/test/unit/fixture/search_full_address.js b/test/unit/fixture/search_full_address.js index 8a8290ab..570e5eca 100644 --- a/test/unit/fixture/search_full_address.js +++ b/test/unit/fixture/search_full_address.js @@ -9,7 +9,7 @@ module.exports = { 'match': { 'name.default': { 'query': '123 main st', - 'analyzer': 'peliasOneEdgeGram', + 'analyzer': 'peliasQueryPartialToken', 'boost': 1 } } diff --git a/test/unit/fixture/search_linguistic_bbox.js b/test/unit/fixture/search_linguistic_bbox.js index 5bb5907c..e9368bd5 100644 --- a/test/unit/fixture/search_linguistic_bbox.js +++ b/test/unit/fixture/search_linguistic_bbox.js @@ -9,7 +9,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } }], diff --git a/test/unit/fixture/search_linguistic_focus.js b/test/unit/fixture/search_linguistic_focus.js index 5d03d66d..c495243a 100644 --- a/test/unit/fixture/search_linguistic_focus.js +++ b/test/unit/fixture/search_linguistic_focus.js @@ -9,7 +9,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } }], diff --git a/test/unit/fixture/search_linguistic_focus_bbox.js b/test/unit/fixture/search_linguistic_focus_bbox.js index 96fe92f6..365b37d8 100644 --- a/test/unit/fixture/search_linguistic_focus_bbox.js +++ b/test/unit/fixture/search_linguistic_focus_bbox.js @@ -9,7 +9,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } }], diff --git a/test/unit/fixture/search_linguistic_focus_null_island.js b/test/unit/fixture/search_linguistic_focus_null_island.js index 0924475d..a9e49a06 100644 --- a/test/unit/fixture/search_linguistic_focus_null_island.js +++ b/test/unit/fixture/search_linguistic_focus_null_island.js @@ -9,7 +9,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } }], diff --git a/test/unit/fixture/search_linguistic_only.js b/test/unit/fixture/search_linguistic_only.js index 58c05826..bf1056f9 100644 --- a/test/unit/fixture/search_linguistic_only.js +++ b/test/unit/fixture/search_linguistic_only.js @@ -9,7 +9,7 @@ module.exports = { 'name.default': { 'query': 'test', 'boost': 1, - 'analyzer': 'peliasOneEdgeGram' + 'analyzer': 'peliasQueryPartialToken' } } }], diff --git a/test/unit/fixture/search_linguistic_viewport.js b/test/unit/fixture/search_linguistic_viewport.js index be76ab05..bcd39af2 100644 --- a/test/unit/fixture/search_linguistic_viewport.js +++ b/test/unit/fixture/search_linguistic_viewport.js @@ -7,7 +7,7 @@ module.exports = { { 'match': { 'name.default': { - 'analyzer': 'peliasOneEdgeGram', + 'analyzer': 'peliasQueryPartialToken', 'boost': 1, 'query': 'test' } diff --git a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js index cf44d0d8..2d1d3e2d 100644 --- a/test/unit/fixture/search_linguistic_viewport_min_diagonal.js +++ b/test/unit/fixture/search_linguistic_viewport_min_diagonal.js @@ -7,7 +7,7 @@ module.exports = { { 'match': { 'name.default': { - 'analyzer': 'peliasOneEdgeGram', + 'analyzer': 'peliasQueryPartialToken', 'boost': 1, 'query': 'test' } diff --git a/test/unit/fixture/search_partial_address.js b/test/unit/fixture/search_partial_address.js index 6c4174b6..aa45ca68 100644 --- a/test/unit/fixture/search_partial_address.js +++ b/test/unit/fixture/search_partial_address.js @@ -10,7 +10,7 @@ module.exports = { 'match': { 'name.default': { 'query': 'soho grand', - 'analyzer': 'peliasOneEdgeGram', + 'analyzer': 'peliasQueryPartialToken', 'boost': 1 } } diff --git a/test/unit/fixture/search_regions_address.js b/test/unit/fixture/search_regions_address.js index e0c05f3c..82127051 100644 --- a/test/unit/fixture/search_regions_address.js +++ b/test/unit/fixture/search_regions_address.js @@ -10,7 +10,7 @@ module.exports = { 'match': { 'name.default': { 'query': '1 water st', - 'analyzer': 'peliasOneEdgeGram', + 'analyzer': 'peliasQueryPartialToken', 'boost': 1 } } diff --git a/test/unit/query/autocomplete.js b/test/unit/query/autocomplete.js index dc973ddc..5ea2182d 100644 --- a/test/unit/query/autocomplete.js +++ b/test/unit/query/autocomplete.js @@ -20,7 +20,7 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/autocomplete_linguistic_only'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_only'); t.end(); }); @@ -30,9 +30,9 @@ module.exports.tests.query = function(test, common) { }); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/autocomplete_linguistic_multiple_tokens.js'); + var expected = require('../fixture/autocomplete_linguistic_multiple_tokens'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_multiple_tokens'); t.end(); }); @@ -47,9 +47,9 @@ module.exports.tests.query = function(test, common) { }); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/autocomplete_linguistic_with_admin.js'); + var expected = require('../fixture/autocomplete_linguistic_with_admin'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_with_admin'); t.end(); }); @@ -62,9 +62,9 @@ module.exports.tests.query = function(test, common) { }); var compiled = JSON.parse( JSON.stringify( query ) ); - var expected = require('../fixture/autocomplete_linguistic_final_token.js'); + var expected = require('../fixture/autocomplete_linguistic_final_token'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_final_token'); t.end(); }); @@ -78,7 +78,7 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/autocomplete_linguistic_focus'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_focus'); t.end(); }); @@ -92,7 +92,7 @@ module.exports.tests.query = function(test, common) { var compiled = JSON.parse( JSON.stringify( query ) ); var expected = require('../fixture/autocomplete_linguistic_focus_null_island'); - t.deepEqual(compiled, expected, 'valid autocomplete query'); + t.deepEqual(compiled, expected, 'autocomplete_linguistic_focus_null_island'); t.end(); }); };