pelias-schema 6.7.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/configValidation.js +0 -1
- package/integration/address_matching.js +3 -19
- package/integration/admin_abbreviations.js +4 -19
- package/integration/admin_matching.js +2 -6
- package/integration/analyzer_peliasAdmin.js +6 -6
- package/integration/analyzer_peliasHousenumber.js +3 -3
- package/integration/analyzer_peliasIndexOneEdgeGram.js +8 -8
- package/integration/analyzer_peliasPhrase.js +8 -13
- package/integration/analyzer_peliasQuery.js +5 -5
- package/integration/analyzer_peliasStreet.js +8 -8
- package/integration/analyzer_peliasZip.js +3 -3
- package/integration/autocomplete_abbreviated_street_names.js +3 -8
- package/integration/autocomplete_directional_synonym_expansion.js +5 -15
- package/integration/autocomplete_street_synonym_expansion.js +5 -15
- package/integration/bounding_box.js +2 -4
- package/integration/dynamic_templates.js +4 -14
- package/integration/multi_token_synonyms.js +2 -3
- package/integration/run.js +1 -3
- package/integration/source_layer_sourceid_filtering.js +6 -13
- package/integration/validate.js +2 -2
- package/mappings/partial/admin.json +1 -2
- package/mappings/partial/countryAbbreviation.json +1 -2
- package/package.json +4 -4
- package/scripts/check_plugins.js +1 -10
- package/scripts/create_index.js +0 -1
- package/scripts/list_analyzers.js +1 -2
- package/scripts/output_mapping.js +1 -18
- package/settings.js +1 -1
- package/test/configValidation.js +1 -37
- package/test/elastictest/Suite.js +103 -0
- package/test/fixtures/expected.json +29 -57
- package/test/settings.js +1 -1
- package/scripts/reset_type.js +0 -26
@@ -1,12 +1,12 @@
|
|
1
1
|
// validate analyzer is behaving as expected
|
2
|
-
const
|
2
|
+
const Suite = require('../test/elastictest/Suite')
|
3
3
|
|
4
4
|
module.exports.tests = {};
|
5
5
|
|
6
6
|
module.exports.tests.analyze = function(test, common){
|
7
7
|
test( 'analyze', function(t){
|
8
8
|
|
9
|
-
var suite = new
|
9
|
+
var suite = new Suite( common.clientOpts, common.create );
|
10
10
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
11
11
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
12
12
|
|
@@ -29,7 +29,7 @@ module.exports.tests.analyze = function(test, common){
|
|
29
29
|
module.exports.tests.functional = function(test, common){
|
30
30
|
test( 'functional', function(t){
|
31
31
|
|
32
|
-
var suite = new
|
32
|
+
var suite = new Suite( common.clientOpts, common.create );
|
33
33
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
34
34
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
35
35
|
|
@@ -46,7 +46,7 @@ module.exports.tests.functional = function(test, common){
|
|
46
46
|
module.exports.tests.normalize_punctuation = function(test, common){
|
47
47
|
test( 'normalize punctuation', function(t){
|
48
48
|
|
49
|
-
var suite = new
|
49
|
+
var suite = new Suite( common.clientOpts, common.create );
|
50
50
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
51
51
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
52
52
|
|
@@ -64,7 +64,7 @@ module.exports.tests.normalize_punctuation = function(test, common){
|
|
64
64
|
module.exports.tests.remove_ordinals = function(test, common){
|
65
65
|
test( 'remove ordinals', function(t){
|
66
66
|
|
67
|
-
var suite = new
|
67
|
+
var suite = new Suite( common.clientOpts, common.create );
|
68
68
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
69
69
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
70
70
|
|
@@ -138,7 +138,7 @@ module.exports.tests.remove_ordinals = function(test, common){
|
|
138
138
|
module.exports.tests.tokenizer = function(test, common){
|
139
139
|
test( 'tokenizer', function(t){
|
140
140
|
|
141
|
-
var suite = new
|
141
|
+
var suite = new Suite( common.clientOpts, common.create );
|
142
142
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
143
143
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
144
144
|
|
@@ -163,7 +163,7 @@ module.exports.tests.tokenizer = function(test, common){
|
|
163
163
|
module.exports.tests.unicode = function(test, common){
|
164
164
|
test( 'normalization', function(t){
|
165
165
|
|
166
|
-
var suite = new
|
166
|
+
var suite = new Suite( common.clientOpts, common.create );
|
167
167
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasStreet' );
|
168
168
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
169
169
|
|
@@ -194,7 +194,7 @@ module.exports.tests.unicode = function(test, common){
|
|
194
194
|
module.exports.tests.germanic_street_suffixes = function (test, common) {
|
195
195
|
test('germanic_street_suffixes', function (t) {
|
196
196
|
|
197
|
-
var suite = new
|
197
|
+
var suite = new Suite(common.clientOpts, common.create );
|
198
198
|
var assertAnalysis = common.analyze.bind(null, suite, t, 'peliasStreet');
|
199
199
|
suite.action(function (done) { setTimeout(done, 500); }); // wait for es to bring some shards up
|
200
200
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// validate analyzer is behaving as expected
|
2
2
|
|
3
3
|
var tape = require('tape'),
|
4
|
-
|
4
|
+
Suite = require('../test/elastictest/Suite'),
|
5
5
|
punctuation = require('../punctuation');
|
6
6
|
|
7
7
|
module.exports.tests = {};
|
@@ -9,7 +9,7 @@ module.exports.tests = {};
|
|
9
9
|
module.exports.tests.analyze = function(test, common){
|
10
10
|
test( 'analyze', function(t){
|
11
11
|
|
12
|
-
var suite = new
|
12
|
+
var suite = new Suite( common.clientOpts, common.create );
|
13
13
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasZip' );
|
14
14
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
15
15
|
|
@@ -24,7 +24,7 @@ module.exports.tests.analyze = function(test, common){
|
|
24
24
|
module.exports.tests.functional = function(test, common){
|
25
25
|
test( 'functional', function(t){
|
26
26
|
|
27
|
-
var suite = new
|
27
|
+
var suite = new Suite( common.clientOpts, common.create );
|
28
28
|
var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasZip' );
|
29
29
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
30
30
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
// The greater issue is descriped in: https://github.com/pelias/pelias/issues/211
|
5
5
|
// The cases tested here are described in: https://github.com/pelias/schema/issues/105
|
6
6
|
|
7
|
-
const
|
7
|
+
const Suite = require('../test/elastictest/Suite');
|
8
8
|
const config = require('pelias-config').generate();
|
9
9
|
const getTotalHits = require('./_hits_total_helper');
|
10
10
|
|
@@ -14,14 +14,13 @@ module.exports.tests = {};
|
|
14
14
|
module.exports.tests.index_expanded_form_search_contracted = function(test, common){
|
15
15
|
test( 'index expanded and retrieve contracted form', function(t){
|
16
16
|
|
17
|
-
var suite = new
|
17
|
+
var suite = new Suite( common.clientOpts, common.create );
|
18
18
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
19
19
|
|
20
20
|
// index a document with a name which contains a synonym (center)
|
21
21
|
suite.action( function( done ){
|
22
22
|
suite.client.index({
|
23
23
|
index: suite.props.index,
|
24
|
-
type: config.schema.typeName,
|
25
24
|
id: '1',
|
26
25
|
body: { name: { default: 'Grolmanstraße' } }
|
27
26
|
}, done);
|
@@ -31,7 +30,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
|
|
31
30
|
suite.assert( function( done ){
|
32
31
|
suite.client.search({
|
33
32
|
index: suite.props.index,
|
34
|
-
type: config.schema.typeName,
|
35
33
|
body: { query: { match: {
|
36
34
|
'name.default': {
|
37
35
|
'analyzer': 'peliasQuery',
|
@@ -55,14 +53,13 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
|
|
55
53
|
// module.exports.tests.index_contracted_form_search_expanded = function(test, common){
|
56
54
|
// test( 'index contracted and search expanded', function(t){
|
57
55
|
|
58
|
-
// var suite = new
|
56
|
+
// var suite = new Suite( common.clientOpts, common.create );
|
59
57
|
// suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
60
58
|
|
61
59
|
// // index a document with a name which contains a synonym (center)
|
62
60
|
// suite.action( function( done ){
|
63
61
|
// suite.client.index({
|
64
62
|
// index: suite.props.index,
|
65
|
-
// type: config.schema.typeName,
|
66
63
|
// id: '1',
|
67
64
|
// body: { name: { default: 'Grolmanstr.' } }
|
68
65
|
// }, done);
|
@@ -75,7 +72,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
|
|
75
72
|
// suite.assert( function( done ){
|
76
73
|
// suite.client.search({
|
77
74
|
// index: suite.props.index,
|
78
|
-
// type: config.schema.typeName,
|
79
75
|
// body: { query: { match: {
|
80
76
|
// 'name.default': {
|
81
77
|
// 'analyzer': 'peliasQueryPartialToken',
|
@@ -96,7 +92,6 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
|
|
96
92
|
// suite.assert( function( done ){
|
97
93
|
// suite.client.search({
|
98
94
|
// index: suite.props.index,
|
99
|
-
// type: config.schema.typeName,
|
100
95
|
// body: { query: { match: {
|
101
96
|
// 'name.default': {
|
102
97
|
// 'analyzer': 'peliasQuery',
|
@@ -4,7 +4,7 @@
|
|
4
4
|
// The greater issue is descriped in: https://github.com/pelias/pelias/issues/211
|
5
5
|
// The cases tested here are described in: https://github.com/pelias/schema/issues/105
|
6
6
|
|
7
|
-
const
|
7
|
+
const Suite = require('../test/elastictest/Suite');
|
8
8
|
const config = require('pelias-config').generate();
|
9
9
|
const getTotalHits = require('./_hits_total_helper');
|
10
10
|
|
@@ -14,14 +14,13 @@ module.exports.tests = {};
|
|
14
14
|
module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
15
15
|
test( 'index and retrieve expanded form', function(t){
|
16
16
|
|
17
|
-
var suite = new
|
17
|
+
var suite = new Suite( common.clientOpts, common.create );
|
18
18
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
19
19
|
|
20
20
|
// index a document with a name which contains a synonym (center)
|
21
21
|
suite.action( function( done ){
|
22
22
|
suite.client.index({
|
23
23
|
index: suite.props.index,
|
24
|
-
type: config.schema.typeName,
|
25
24
|
id: '1',
|
26
25
|
body: { name: { default: 'north' } }
|
27
26
|
}, done);
|
@@ -31,7 +30,6 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
31
30
|
suite.assert( function( done ){
|
32
31
|
suite.client.search({
|
33
32
|
index: suite.props.index,
|
34
|
-
type: config.schema.typeName,
|
35
33
|
body: { query: { match: {
|
36
34
|
'name.default': {
|
37
35
|
'analyzer': 'peliasQuery',
|
@@ -49,7 +47,6 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
49
47
|
suite.assert( function( done ){
|
50
48
|
suite.client.search({
|
51
49
|
index: suite.props.index,
|
52
|
-
type: config.schema.typeName,
|
53
50
|
body: { query: { match: {
|
54
51
|
'name.default': {
|
55
52
|
'analyzer': 'peliasQuery',
|
@@ -71,14 +68,13 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
71
68
|
module.exports.tests.index_and_retrieve_contracted_form = function(test, common){
|
72
69
|
test( 'index and retrieve contracted form', function(t){
|
73
70
|
|
74
|
-
var suite = new
|
71
|
+
var suite = new Suite( common.clientOpts, common.create );
|
75
72
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
76
73
|
|
77
74
|
// index a document with a name which contains a synonym (center)
|
78
75
|
suite.action( function( done ){
|
79
76
|
suite.client.index({
|
80
77
|
index: suite.props.index,
|
81
|
-
type: config.schema.typeName,
|
82
78
|
id: '1',
|
83
79
|
body: { name: { default: 'n' } }
|
84
80
|
}, done);
|
@@ -88,7 +84,6 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
|
|
88
84
|
suite.assert( function( done ){
|
89
85
|
suite.client.search({
|
90
86
|
index: suite.props.index,
|
91
|
-
type: config.schema.typeName,
|
92
87
|
body: { query: { match: {
|
93
88
|
'name.default': {
|
94
89
|
'analyzer': 'peliasQuery',
|
@@ -110,14 +105,13 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
|
|
110
105
|
module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
111
106
|
test( 'index and retrieve mixed form 1', function(t){
|
112
107
|
|
113
|
-
var suite = new
|
108
|
+
var suite = new Suite( common.clientOpts, common.create );
|
114
109
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
115
110
|
|
116
111
|
// index a document with a name which contains a synonym (center)
|
117
112
|
suite.action( function( done ){
|
118
113
|
suite.client.index({
|
119
114
|
index: suite.props.index,
|
120
|
-
type: config.schema.typeName,
|
121
115
|
id: '1',
|
122
116
|
body: { name: { default: 'n' } }
|
123
117
|
}, done);
|
@@ -127,7 +121,6 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
127
121
|
suite.assert( function( done ){
|
128
122
|
suite.client.search({
|
129
123
|
index: suite.props.index,
|
130
|
-
type: config.schema.typeName,
|
131
124
|
body: { query: { match: {
|
132
125
|
'name.default': {
|
133
126
|
'analyzer': 'peliasQuery',
|
@@ -145,7 +138,6 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
145
138
|
suite.assert( function( done ){
|
146
139
|
suite.client.search({
|
147
140
|
index: suite.props.index,
|
148
|
-
type: config.schema.typeName,
|
149
141
|
body: { query: { match: {
|
150
142
|
'name.default': {
|
151
143
|
'analyzer': 'peliasQuery',
|
@@ -167,14 +159,13 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
167
159
|
module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
|
168
160
|
test( 'index and retrieve mixed form 2', function(t){
|
169
161
|
|
170
|
-
var suite = new
|
162
|
+
var suite = new Suite( common.clientOpts, common.create );
|
171
163
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
172
164
|
|
173
165
|
// index a document with a name which contains a synonym (center)
|
174
166
|
suite.action( function( done ){
|
175
167
|
suite.client.index({
|
176
168
|
index: suite.props.index,
|
177
|
-
type: config.schema.typeName,
|
178
169
|
id: '1',
|
179
170
|
body: { name: { default: 'north' } }
|
180
171
|
}, done);
|
@@ -184,7 +175,6 @@ module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
|
|
184
175
|
suite.assert( function( done ){
|
185
176
|
suite.client.search({
|
186
177
|
index: suite.props.index,
|
187
|
-
type: config.schema.typeName,
|
188
178
|
body: { query: { match: {
|
189
179
|
'name.default': {
|
190
180
|
'analyzer': 'peliasQuery',
|
@@ -4,7 +4,7 @@
|
|
4
4
|
// The greater issue is descriped in: https://github.com/pelias/pelias/issues/211
|
5
5
|
// The cases tested here are described in: https://github.com/pelias/schema/issues/105
|
6
6
|
|
7
|
-
const
|
7
|
+
const Suite = require('../test/elastictest/Suite');
|
8
8
|
const config = require('pelias-config').generate();
|
9
9
|
|
10
10
|
const getTotalHits = require('./_hits_total_helper');
|
@@ -15,14 +15,13 @@ module.exports.tests = {};
|
|
15
15
|
module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
16
16
|
test( 'index and retrieve expanded form', function(t){
|
17
17
|
|
18
|
-
var suite = new
|
18
|
+
var suite = new Suite( common.clientOpts, common.create );
|
19
19
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
20
20
|
|
21
21
|
// index a document with a name which contains a synonym (center)
|
22
22
|
suite.action( function( done ){
|
23
23
|
suite.client.index({
|
24
24
|
index: suite.props.index,
|
25
|
-
type: config.schema.typeName,
|
26
25
|
id: '1',
|
27
26
|
body: { name: { default: 'center' } }
|
28
27
|
}, done);
|
@@ -32,7 +31,6 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
32
31
|
suite.assert( function( done ){
|
33
32
|
suite.client.search({
|
34
33
|
index: suite.props.index,
|
35
|
-
type: config.schema.typeName,
|
36
34
|
body: { query: { match: {
|
37
35
|
'name.default': {
|
38
36
|
'analyzer': 'peliasQuery',
|
@@ -50,7 +48,6 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
50
48
|
suite.assert( function( done ){
|
51
49
|
suite.client.search({
|
52
50
|
index: suite.props.index,
|
53
|
-
type: config.schema.typeName,
|
54
51
|
body: { query: { match: {
|
55
52
|
'name.default': {
|
56
53
|
'analyzer': 'peliasQuery',
|
@@ -72,14 +69,13 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
|
|
72
69
|
module.exports.tests.index_and_retrieve_contracted_form = function(test, common){
|
73
70
|
test( 'index and retrieve contracted form', function(t){
|
74
71
|
|
75
|
-
var suite = new
|
72
|
+
var suite = new Suite( common.clientOpts, common.create );
|
76
73
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
77
74
|
|
78
75
|
// index a document with a name which contains a synonym (center)
|
79
76
|
suite.action( function( done ){
|
80
77
|
suite.client.index({
|
81
78
|
index: suite.props.index,
|
82
|
-
type: config.schema.typeName,
|
83
79
|
id: '1',
|
84
80
|
body: { name: { default: 'ctr' } }
|
85
81
|
}, done);
|
@@ -89,7 +85,6 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
|
|
89
85
|
suite.assert( function( done ){
|
90
86
|
suite.client.search({
|
91
87
|
index: suite.props.index,
|
92
|
-
type: config.schema.typeName,
|
93
88
|
body: { query: { match: {
|
94
89
|
'name.default': {
|
95
90
|
'analyzer': 'peliasQuery',
|
@@ -111,14 +106,13 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
|
|
111
106
|
module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
112
107
|
test( 'index and retrieve mixed form 1', function(t){
|
113
108
|
|
114
|
-
var suite = new
|
109
|
+
var suite = new Suite( common.clientOpts, common.create );
|
115
110
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
116
111
|
|
117
112
|
// index a document with a name which contains a synonym (center)
|
118
113
|
suite.action( function( done ){
|
119
114
|
suite.client.index({
|
120
115
|
index: suite.props.index,
|
121
|
-
type: config.schema.typeName,
|
122
116
|
id: '1',
|
123
117
|
body: { name: { default: 'ctr' } }
|
124
118
|
}, done);
|
@@ -128,7 +122,6 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
128
122
|
suite.assert( function( done ){
|
129
123
|
suite.client.search({
|
130
124
|
index: suite.props.index,
|
131
|
-
type: config.schema.typeName,
|
132
125
|
body: { query: { match: {
|
133
126
|
'name.default': {
|
134
127
|
'analyzer': 'peliasQuery',
|
@@ -146,7 +139,6 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
146
139
|
suite.assert( function( done ){
|
147
140
|
suite.client.search({
|
148
141
|
index: suite.props.index,
|
149
|
-
type: config.schema.typeName,
|
150
142
|
body: { query: { match: {
|
151
143
|
'name.default': {
|
152
144
|
'analyzer': 'peliasQuery',
|
@@ -168,14 +160,13 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
|
|
168
160
|
module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
|
169
161
|
test( 'index and retrieve mixed form 2', function(t){
|
170
162
|
|
171
|
-
var suite = new
|
163
|
+
var suite = new Suite( common.clientOpts, common.create );
|
172
164
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
173
165
|
|
174
166
|
// index a document with a name which contains a synonym (center)
|
175
167
|
suite.action( function( done ){
|
176
168
|
suite.client.index({
|
177
169
|
index: suite.props.index,
|
178
|
-
type: config.schema.typeName,
|
179
170
|
id: '1',
|
180
171
|
body: { name: { default: 'center' } }
|
181
172
|
}, done);
|
@@ -185,7 +176,6 @@ module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
|
|
185
176
|
suite.assert( function( done ){
|
186
177
|
suite.client.search({
|
187
178
|
index: suite.props.index,
|
188
|
-
type: config.schema.typeName,
|
189
179
|
body: { query: { match: {
|
190
180
|
'name.default': {
|
191
181
|
'analyzer': 'peliasQuery',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// validate bounding box behaves as expected
|
2
2
|
|
3
|
-
const
|
3
|
+
const Suite = require('../test/elastictest/Suite');
|
4
4
|
const config = require('pelias-config').generate();
|
5
5
|
|
6
6
|
module.exports.tests = {};
|
@@ -8,14 +8,13 @@ module.exports.tests = {};
|
|
8
8
|
module.exports.tests.index_and_retrieve = function(test, common){
|
9
9
|
test( 'index and retrieve', function(t){
|
10
10
|
|
11
|
-
var suite = new
|
11
|
+
var suite = new Suite( common.clientOpts, common.create );
|
12
12
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
13
13
|
|
14
14
|
// index a document with a bbox
|
15
15
|
suite.action( function( done ){
|
16
16
|
suite.client.index({
|
17
17
|
index: suite.props.index,
|
18
|
-
type: config.schema.typeName,
|
19
18
|
id: '1',
|
20
19
|
body: {
|
21
20
|
bounding_box: '{"min_lat":-47.75,"max_lat":-33.9,"min_lon":163.82,"max_lon":179.42}'
|
@@ -28,7 +27,6 @@ module.exports.tests.index_and_retrieve = function(test, common){
|
|
28
27
|
suite.client.get(
|
29
28
|
{
|
30
29
|
index: suite.props.index,
|
31
|
-
type: config.schema.typeName,
|
32
30
|
id: '1'
|
33
31
|
},
|
34
32
|
function (err, res) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// http://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates
|
2
2
|
|
3
|
-
const
|
3
|
+
const Suite = require('../test/elastictest/Suite');
|
4
4
|
const config = require('pelias-config').generate();
|
5
5
|
|
6
6
|
module.exports.tests = {};
|
@@ -31,14 +31,12 @@ module.exports.all = function (tape, common) {
|
|
31
31
|
function nameAssertion( analyzer, common ){
|
32
32
|
return function(t){
|
33
33
|
|
34
|
-
var suite = new
|
35
|
-
const _type = config.schema.typeName;
|
34
|
+
var suite = new Suite( common.clientOpts, common.create );
|
36
35
|
|
37
36
|
// index a document from a normal document layer
|
38
37
|
suite.action( done => {
|
39
38
|
suite.client.index({
|
40
39
|
index: suite.props.index,
|
41
|
-
type: _type,
|
42
40
|
id: '1',
|
43
41
|
body: { name: { default: 'foo', alt: 'bar' } }
|
44
42
|
}, done );
|
@@ -50,7 +48,6 @@ function nameAssertion( analyzer, common ){
|
|
50
48
|
|
51
49
|
suite.client.indices.getMapping({
|
52
50
|
index: suite.props.index,
|
53
|
-
include_type_name: false
|
54
51
|
}, (err, res) => {
|
55
52
|
|
56
53
|
const properties = res[suite.props.index].mappings.properties;
|
@@ -70,14 +67,12 @@ function nameAssertion( analyzer, common ){
|
|
70
67
|
function phraseAssertion( analyzer, common ){
|
71
68
|
return function(t){
|
72
69
|
|
73
|
-
const suite = new
|
74
|
-
const _type = config.schema.typeName;
|
70
|
+
const suite = new Suite( common.clientOpts, common.create );
|
75
71
|
|
76
72
|
// index a document from a normal document layer
|
77
73
|
suite.action( done => {
|
78
74
|
suite.client.index({
|
79
75
|
index: suite.props.index,
|
80
|
-
type: _type,
|
81
76
|
id: '1',
|
82
77
|
body: { phrase: { default: 'foo', alt: 'bar' } }
|
83
78
|
}, done );
|
@@ -89,7 +84,6 @@ function phraseAssertion( analyzer, common ){
|
|
89
84
|
|
90
85
|
suite.client.indices.getMapping({
|
91
86
|
index: suite.props.index,
|
92
|
-
include_type_name: false
|
93
87
|
}, ( err, res ) => {
|
94
88
|
|
95
89
|
const properties = res[suite.props.index].mappings.properties;
|
@@ -109,14 +103,12 @@ function phraseAssertion( analyzer, common ){
|
|
109
103
|
function addendumAssertion( namespace, value, common ){
|
110
104
|
return function(t){
|
111
105
|
|
112
|
-
const suite = new
|
113
|
-
const _type = config.schema.typeName;
|
106
|
+
const suite = new Suite( common.clientOpts, common.create );
|
114
107
|
|
115
108
|
// index a document including the addendum
|
116
109
|
suite.action( done => {
|
117
110
|
suite.client.index({
|
118
111
|
index: suite.props.index,
|
119
|
-
type: _type,
|
120
112
|
id: '1',
|
121
113
|
body: { addendum: { [namespace]: value } },
|
122
114
|
}, done );
|
@@ -127,7 +119,6 @@ function addendumAssertion( namespace, value, common ){
|
|
127
119
|
suite.assert( done => {
|
128
120
|
suite.client.indices.getMapping({
|
129
121
|
index: suite.props.index,
|
130
|
-
include_type_name: false,
|
131
122
|
}, ( err, res ) => {
|
132
123
|
|
133
124
|
const properties = res[suite.props.index].mappings.properties;
|
@@ -156,7 +147,6 @@ function addendumAssertion( namespace, value, common ){
|
|
156
147
|
suite.assert( done => {
|
157
148
|
suite.client.get({
|
158
149
|
index: suite.props.index,
|
159
|
-
type: _type,
|
160
150
|
id: 1
|
161
151
|
}, ( err, res ) => {
|
162
152
|
t.false( err );
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// validate analyzer is behaving as expected
|
2
2
|
|
3
|
-
const
|
3
|
+
const Suite = require('../test/elastictest/Suite');
|
4
4
|
const config = require('pelias-config').generate();
|
5
5
|
|
6
6
|
module.exports.tests = {};
|
@@ -10,7 +10,7 @@ module.exports.tests = {};
|
|
10
10
|
module.exports.tests.functional = function (test, common) {
|
11
11
|
test('functional', function (t) {
|
12
12
|
|
13
|
-
var suite = new
|
13
|
+
var suite = new Suite(common.clientOpts, common.create);
|
14
14
|
suite.action(function (done) { setTimeout(done, 500); }); // wait for es to bring some shards up
|
15
15
|
|
16
16
|
// index a document with all admin values
|
@@ -19,7 +19,6 @@ module.exports.tests.functional = function (test, common) {
|
|
19
19
|
suite.action(function (done) {
|
20
20
|
suite.client.index({
|
21
21
|
index: suite.props.index,
|
22
|
-
type: config.schema.typeName,
|
23
22
|
id: '1', body: {
|
24
23
|
name: { default: 'set' },
|
25
24
|
phrase: { default: 'set' },
|
package/integration/run.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// validate analyzer is behaving as expected
|
2
2
|
|
3
|
-
const
|
3
|
+
const Suite = require('../test/elastictest/Suite');
|
4
4
|
const config = require('pelias-config').generate();
|
5
5
|
const getTotalHits = require('./_hits_total_helper');
|
6
6
|
|
@@ -9,34 +9,34 @@ module.exports.tests = {};
|
|
9
9
|
module.exports.tests.source_filter = function(test, common){
|
10
10
|
test( 'source filter', function(t){
|
11
11
|
|
12
|
-
var suite = new
|
12
|
+
var suite = new Suite( common.clientOpts, common.create );
|
13
13
|
suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
|
14
14
|
|
15
15
|
// index some docs
|
16
16
|
suite.action( function( done ){
|
17
17
|
suite.client.index({
|
18
|
-
index: suite.props.index,
|
18
|
+
index: suite.props.index,
|
19
19
|
id: '1', body: { source: 'osm', layer: 'node', source_id: 'dataset/1' }
|
20
20
|
}, done );
|
21
21
|
});
|
22
22
|
|
23
23
|
suite.action( function( done ){
|
24
24
|
suite.client.index({
|
25
|
-
index: suite.props.index,
|
25
|
+
index: suite.props.index,
|
26
26
|
id: '2', body: { source: 'osm', layer: 'address', source_id: 'dataset/2' }
|
27
27
|
}, done );
|
28
28
|
});
|
29
29
|
|
30
30
|
suite.action( function( done ){
|
31
31
|
suite.client.index({
|
32
|
-
index: suite.props.index,
|
32
|
+
index: suite.props.index,
|
33
33
|
id: '3', body: { source: 'geonames', layer: 'address', source_id: 'dataset/1' }
|
34
34
|
}, done );
|
35
35
|
});
|
36
36
|
|
37
37
|
suite.action( function( done ){
|
38
38
|
suite.client.index({
|
39
|
-
index: suite.props.index,
|
39
|
+
index: suite.props.index,
|
40
40
|
id: '4', body: { source: 'foo bar baz' }
|
41
41
|
}, done );
|
42
42
|
});
|
@@ -45,7 +45,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
45
45
|
suite.assert( function( done ){
|
46
46
|
suite.client.search({
|
47
47
|
index: suite.props.index,
|
48
|
-
type: config.schema.typeName,
|
49
48
|
body: { query: {
|
50
49
|
term: {
|
51
50
|
source: 'osm'
|
@@ -61,7 +60,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
61
60
|
suite.assert( function( done ){
|
62
61
|
suite.client.search({
|
63
62
|
index: suite.props.index,
|
64
|
-
type: config.schema.typeName,
|
65
63
|
body: { query: {
|
66
64
|
term: {
|
67
65
|
layer: 'address'
|
@@ -77,7 +75,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
77
75
|
suite.assert( function( done ){
|
78
76
|
suite.client.search({
|
79
77
|
index: suite.props.index,
|
80
|
-
type: config.schema.typeName,
|
81
78
|
body: { query: {
|
82
79
|
term: {
|
83
80
|
source_id: 'dataset/1'
|
@@ -93,7 +90,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
93
90
|
suite.assert( function( done ){
|
94
91
|
suite.client.search({
|
95
92
|
index: suite.props.index,
|
96
|
-
type: config.schema.typeName,
|
97
93
|
body: { query: { bool: { must: [
|
98
94
|
{ term: { source: 'osm' } },
|
99
95
|
{ term: { source_id: 'dataset/1' } }
|
@@ -108,7 +104,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
108
104
|
suite.assert( function( done ){
|
109
105
|
suite.client.search({
|
110
106
|
index: suite.props.index,
|
111
|
-
type: config.schema.typeName,
|
112
107
|
body: { query: {
|
113
108
|
term: {
|
114
109
|
source: 'OSM'
|
@@ -124,7 +119,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
124
119
|
suite.assert( function( done ){
|
125
120
|
suite.client.search({
|
126
121
|
index: suite.props.index,
|
127
|
-
type: config.schema.typeName,
|
128
122
|
body: { query: {
|
129
123
|
term: {
|
130
124
|
source: 'foo'
|
@@ -140,7 +134,6 @@ module.exports.tests.source_filter = function(test, common){
|
|
140
134
|
suite.assert( function( done ){
|
141
135
|
suite.client.search({
|
142
136
|
index: suite.props.index,
|
143
|
-
type: config.schema.typeName,
|
144
137
|
body: { query: {
|
145
138
|
term: {
|
146
139
|
source: 'foo bar baz'
|
package/integration/validate.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
// simply validate that the schema doesn't error when inserted in to
|
2
2
|
// your local elasticsearch server, useful to sanity check version upgrades.
|
3
3
|
|
4
|
-
const
|
4
|
+
const Suite = require('../test/elastictest/Suite');
|
5
5
|
|
6
6
|
module.exports.tests = {};
|
7
7
|
|
8
8
|
module.exports.tests.validate = function(test, common){
|
9
9
|
test( 'schema', t => {
|
10
10
|
|
11
|
-
var suite = new
|
11
|
+
var suite = new Suite( common.clientOpts, common.create );
|
12
12
|
|
13
13
|
suite.assert( done => {
|
14
14
|
suite.client.info({}, ( err, res, status ) => {
|