Browse Source

update analyzers to work with https://github.com/pelias/schema/pull/109

pull/474/head
Peter Johnson 9 years ago
parent
commit
aa3e764e49
  1. 6
      query/autocomplete_defaults.js
  2. 2
      query/reverse_defaults.js
  3. 2
      query/search_defaults.js
  4. 6
      test/unit/fixture/autocomplete_linguistic_final_token.js
  5. 8
      test/unit/fixture/autocomplete_linguistic_focus.js
  6. 8
      test/unit/fixture/autocomplete_linguistic_focus_null_island.js
  7. 10
      test/unit/fixture/autocomplete_linguistic_multiple_tokens.js
  8. 6
      test/unit/fixture/autocomplete_linguistic_only.js
  9. 8
      test/unit/fixture/autocomplete_linguistic_with_admin.js
  10. 2
      test/unit/fixture/search_boundary_country.js
  11. 2
      test/unit/fixture/search_full_address.js
  12. 2
      test/unit/fixture/search_linguistic_bbox.js
  13. 2
      test/unit/fixture/search_linguistic_focus.js
  14. 2
      test/unit/fixture/search_linguistic_focus_bbox.js
  15. 2
      test/unit/fixture/search_linguistic_focus_null_island.js
  16. 2
      test/unit/fixture/search_linguistic_only.js
  17. 2
      test/unit/fixture/search_linguistic_viewport.js
  18. 2
      test/unit/fixture/search_linguistic_viewport_min_diagonal.js
  19. 2
      test/unit/fixture/search_partial_address.js
  20. 2
      test/unit/fixture/search_regions_address.js
  21. 18
      test/unit/query/autocomplete.js

6
query/autocomplete_defaults.js

@ -20,12 +20,12 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'boundary:rect:type': 'indexed', 'boundary:rect:type': 'indexed',
'boundary:rect:_cache': true, 'boundary:rect:_cache': true,
'ngram:analyzer': 'peliasPhrase', 'ngram:analyzer': 'peliasQueryPartialToken',
'ngram:field': 'name.default', 'ngram:field': 'name.default',
'ngram:boost': 100, 'ngram:boost': 100,
'phrase:analyzer': 'peliasPhrase', 'phrase:analyzer': 'peliasQueryFullToken',
'phrase:field': 'phrase.default', 'phrase:field': 'name.default',
'phrase:boost': 1, 'phrase:boost': 1,
'phrase:slop': 2, 'phrase:slop': 2,

2
query/reverse_defaults.js

@ -20,7 +20,7 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'boundary:rect:type': 'indexed', 'boundary:rect:type': 'indexed',
'boundary:rect:_cache': true, 'boundary:rect:_cache': true,
'ngram:analyzer': 'peliasOneEdgeGram', 'ngram:analyzer': 'peliasQueryPartialToken',
'ngram:field': 'name.default', 'ngram:field': 'name.default',
'ngram:boost': 1, 'ngram:boost': 1,

2
query/search_defaults.js

@ -20,7 +20,7 @@ module.exports = _.merge({}, peliasQuery.defaults, {
'boundary:rect:type': 'indexed', 'boundary:rect:type': 'indexed',
'boundary:rect:_cache': true, 'boundary:rect:_cache': true,
'ngram:analyzer': 'peliasOneEdgeGram', 'ngram:analyzer': 'peliasQueryPartialToken',
'ngram:field': 'name.default', 'ngram:field': 'name.default',
'ngram:boost': 1, 'ngram:boost': 1,

6
test/unit/fixture/autocomplete_linguistic_final_token.js

@ -7,7 +7,7 @@ module.exports = {
'must': [{ 'must': [{
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one', 'query': 'one',
'type': 'phrase', 'type': 'phrase',
@ -20,7 +20,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one', 'query': 'one',
'type': 'phrase', 'type': 'phrase',
@ -45,7 +45,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one', 'query': 'one',
'type': 'phrase', 'type': 'phrase',

8
test/unit/fixture/autocomplete_linguistic_focus.js

@ -7,7 +7,7 @@ module.exports = {
'must': [{ 'must': [{
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -20,7 +20,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -64,7 +64,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -89,7 +89,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',

8
test/unit/fixture/autocomplete_linguistic_focus_null_island.js

@ -7,7 +7,7 @@ module.exports = {
'must': [{ 'must': [{
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -20,7 +20,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -64,7 +64,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -89,7 +89,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',

10
test/unit/fixture/autocomplete_linguistic_multiple_tokens.js

@ -6,8 +6,8 @@ module.exports = {
'bool': { 'bool': {
'must': [{ 'must': [{
'match': { 'match': {
'phrase.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryFullToken',
'type': 'phrase', 'type': 'phrase',
'boost': 1, 'boost': 1,
'slop': 2, 'slop': 2,
@ -18,7 +18,7 @@ module.exports = {
{ {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'three', 'query': 'three',
'type': 'phrase', 'type': 'phrase',
@ -31,7 +31,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one two three', 'query': 'one two three',
'type': 'phrase', 'type': 'phrase',
@ -56,7 +56,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one two three', 'query': 'one two three',
'type': 'phrase', 'type': 'phrase',

6
test/unit/fixture/autocomplete_linguistic_only.js

@ -7,7 +7,7 @@ module.exports = {
'must': [{ 'must': [{
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -20,7 +20,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',
@ -45,7 +45,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'test', 'query': 'test',
'type': 'phrase', 'type': 'phrase',

8
test/unit/fixture/autocomplete_linguistic_with_admin.js

@ -7,8 +7,8 @@ module.exports = {
'must': [ 'must': [
{ {
'match': { 'match': {
'phrase.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryFullToken',
'type': 'phrase', 'type': 'phrase',
'boost': 1, 'boost': 1,
'slop': 2, 'slop': 2,
@ -86,7 +86,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one two', 'query': 'one two',
'type': 'phrase', 'type': 'phrase',
@ -114,7 +114,7 @@ module.exports = {
'query': { 'query': {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasPhrase', 'analyzer': 'peliasQueryPartialToken',
'boost': 100, 'boost': 100,
'query': 'one two', 'query': 'one two',
'type': 'phrase', 'type': 'phrase',

2
test/unit/fixture/search_boundary_country.js

@ -18,7 +18,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
} }

2
test/unit/fixture/search_full_address.js

@ -9,7 +9,7 @@ module.exports = {
'match': { 'match': {
'name.default': { 'name.default': {
'query': '123 main st', 'query': '123 main st',
'analyzer': 'peliasOneEdgeGram', 'analyzer': 'peliasQueryPartialToken',
'boost': 1 'boost': 1
} }
} }

2
test/unit/fixture/search_linguistic_bbox.js

@ -9,7 +9,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
}], }],

2
test/unit/fixture/search_linguistic_focus.js

@ -9,7 +9,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
}], }],

2
test/unit/fixture/search_linguistic_focus_bbox.js

@ -9,7 +9,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
}], }],

2
test/unit/fixture/search_linguistic_focus_null_island.js

@ -9,7 +9,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
}], }],

2
test/unit/fixture/search_linguistic_only.js

@ -9,7 +9,7 @@ module.exports = {
'name.default': { 'name.default': {
'query': 'test', 'query': 'test',
'boost': 1, 'boost': 1,
'analyzer': 'peliasOneEdgeGram' 'analyzer': 'peliasQueryPartialToken'
} }
} }
}], }],

2
test/unit/fixture/search_linguistic_viewport.js

@ -7,7 +7,7 @@ module.exports = {
{ {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasOneEdgeGram', 'analyzer': 'peliasQueryPartialToken',
'boost': 1, 'boost': 1,
'query': 'test' 'query': 'test'
} }

2
test/unit/fixture/search_linguistic_viewport_min_diagonal.js

@ -7,7 +7,7 @@ module.exports = {
{ {
'match': { 'match': {
'name.default': { 'name.default': {
'analyzer': 'peliasOneEdgeGram', 'analyzer': 'peliasQueryPartialToken',
'boost': 1, 'boost': 1,
'query': 'test' 'query': 'test'
} }

2
test/unit/fixture/search_partial_address.js

@ -10,7 +10,7 @@ module.exports = {
'match': { 'match': {
'name.default': { 'name.default': {
'query': 'soho grand', 'query': 'soho grand',
'analyzer': 'peliasOneEdgeGram', 'analyzer': 'peliasQueryPartialToken',
'boost': 1 'boost': 1
} }
} }

2
test/unit/fixture/search_regions_address.js

@ -10,7 +10,7 @@ module.exports = {
'match': { 'match': {
'name.default': { 'name.default': {
'query': '1 water st', 'query': '1 water st',
'analyzer': 'peliasOneEdgeGram', 'analyzer': 'peliasQueryPartialToken',
'boost': 1 'boost': 1
} }
} }

18
test/unit/query/autocomplete.js

@ -20,7 +20,7 @@ module.exports.tests.query = function(test, common) {
var compiled = JSON.parse( JSON.stringify( query ) ); var compiled = JSON.parse( JSON.stringify( query ) );
var expected = require('../fixture/autocomplete_linguistic_only'); var expected = require('../fixture/autocomplete_linguistic_only');
t.deepEqual(compiled, expected, 'valid autocomplete query'); t.deepEqual(compiled, expected, 'autocomplete_linguistic_only');
t.end(); t.end();
}); });
@ -30,9 +30,9 @@ module.exports.tests.query = function(test, common) {
}); });
var compiled = JSON.parse( JSON.stringify( query ) ); 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(); t.end();
}); });
@ -47,9 +47,9 @@ module.exports.tests.query = function(test, common) {
}); });
var compiled = JSON.parse( JSON.stringify( query ) ); 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(); t.end();
}); });
@ -62,9 +62,9 @@ module.exports.tests.query = function(test, common) {
}); });
var compiled = JSON.parse( JSON.stringify( query ) ); 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(); t.end();
}); });
@ -78,7 +78,7 @@ module.exports.tests.query = function(test, common) {
var compiled = JSON.parse( JSON.stringify( query ) ); var compiled = JSON.parse( JSON.stringify( query ) );
var expected = require('../fixture/autocomplete_linguistic_focus'); var expected = require('../fixture/autocomplete_linguistic_focus');
t.deepEqual(compiled, expected, 'valid autocomplete query'); t.deepEqual(compiled, expected, 'autocomplete_linguistic_focus');
t.end(); t.end();
}); });
@ -92,7 +92,7 @@ module.exports.tests.query = function(test, common) {
var compiled = JSON.parse( JSON.stringify( query ) ); var compiled = JSON.parse( JSON.stringify( query ) );
var expected = require('../fixture/autocomplete_linguistic_focus_null_island'); 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(); t.end();
}); });
}; };

Loading…
Cancel
Save