pelias-schema 6.6.0 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ jobs:
7
7
  matrix:
8
8
  os:
9
9
  - ${{ vars.UBUNTU_VERSION }}
10
- node-version: [14.x, 16.x]
10
+ node-version: [16.x, 18.x]
11
11
  es-version: [7.6.1]
12
12
  jdk-version: [oraclejdk11]
13
13
  steps:
@@ -23,7 +23,6 @@ jobs:
23
23
  run: ./scripts/setup_ci.sh
24
24
  - name: Run integration tests
25
25
  run: |
26
- npm install -g npm
27
26
  npm install
28
27
  curl http://127.0.0.1:9200/
29
28
  ./bin/create_index
@@ -7,7 +7,7 @@ jobs:
7
7
  matrix:
8
8
  os:
9
9
  - ${{ vars.UBUNTU_VERSION }}
10
- node-version: [14.x, 16.x]
10
+ node-version: [16.x, 18.x]
11
11
  steps:
12
12
  - uses: actions/checkout@v2
13
13
  - name: Install node.js ${{ matrix.node-version }}
@@ -16,6 +16,5 @@ jobs:
16
16
  node-version: ${{ matrix.node-version }}
17
17
  - name: Run unit tests
18
18
  run: |
19
- npm install -g npm
20
19
  npm install
21
20
  npm run test
@@ -17,7 +17,7 @@ jobs:
17
17
  - name: Install Node.js
18
18
  uses: actions/setup-node@v2-beta
19
19
  with:
20
- node-version: 16.x
20
+ node-version: 20.x
21
21
  - name: Run semantic-release
22
22
  env:
23
23
  GH_TOKEN: ${{ secrets.GH_SEMANTIC_RELEASE_TOKEN }}
@@ -1,6 +1,6 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
- const elastictest = require('elastictest');
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,7 +9,7 @@ module.exports.tests = {};
9
9
  module.exports.tests.functional = function(test, common){
10
10
  test( 'functional', function(t){
11
11
 
12
- var suite = new elastictest.Suite( common.clientOpts, common.create );
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
@@ -217,7 +217,7 @@ module.exports.tests.venue_vs_address = function(test, common){
217
217
  // Unfortunately there seems to be no easy way of fixing this, it's an artifact of us
218
218
  // storing the street names in the name.default field.
219
219
 
220
- var suite = new elastictest.Suite( common.clientOpts, common.create );
220
+ var suite = new Suite( common.clientOpts, common.create );
221
221
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
222
222
 
223
223
  // index a venue
@@ -1,4 +1,4 @@
1
- const elastictest = require('elastictest');
1
+ const Suite = require('../test/elastictest/Suite');
2
2
  const config = require('pelias-config').generate();
3
3
  const getTotalHits = require('./_hits_total_helper');
4
4
 
@@ -12,7 +12,7 @@ module.exports.tests = {};
12
12
  module.exports.tests.synonyms = function (test, common) {
13
13
  test('synonyms - alpha3 does not share a prefix with alpha2', function (t) {
14
14
 
15
- var suite = new elastictest.Suite(common.clientOpts, common.create);
15
+ var suite = new Suite(common.clientOpts, common.create);
16
16
  suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up
17
17
 
18
18
  // index document 1 with country_a='MEX'
@@ -140,7 +140,7 @@ module.exports.tests.synonyms = function (test, common) {
140
140
 
141
141
  test('synonyms - alpha3 shares a prefix with alpha2', function (t) {
142
142
 
143
- var suite = new elastictest.Suite(common.clientOpts, common.create);
143
+ var suite = new Suite(common.clientOpts, common.create);
144
144
  suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up
145
145
 
146
146
  // index document 1 with country_a='NZL'
@@ -268,7 +268,7 @@ module.exports.tests.synonyms = function (test, common) {
268
268
 
269
269
  test('synonyms - additional synonyms do not increase field length', function (t) {
270
270
 
271
- var suite = new elastictest.Suite(common.clientOpts, common.create);
271
+ var suite = new Suite(common.clientOpts, common.create);
272
272
  suite.action(done => setTimeout(done, 500)); // wait for es to bring some shards up
273
273
 
274
274
  // index document 1 with country_a='NZL'
@@ -1,6 +1,6 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
- const elastictest = require('elastictest');
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,7 +9,7 @@ module.exports.tests = {};
9
9
  module.exports.tests.functional = function(test, common){
10
10
  test( 'functional', function(t){
11
11
 
12
- var suite = new elastictest.Suite( common.clientOpts, common.create );
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 a document with all admin values
@@ -1,7 +1,7 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
3
  var tape = require('tape'),
4
- elastictest = require('elastictest'),
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 elastictest.Suite( common.clientOpts, common.create );
12
+ var suite = new Suite( common.clientOpts, common.create );
13
13
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
14
14
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
15
15
 
@@ -33,7 +33,7 @@ module.exports.tests.analyze = function(test, common){
33
33
  module.exports.tests.functional = function(test, common){
34
34
  test( 'functional', function(t){
35
35
 
36
- var suite = new elastictest.Suite( common.clientOpts, common.create );
36
+ var suite = new Suite( common.clientOpts, common.create );
37
37
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
38
38
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
39
39
 
@@ -71,7 +71,7 @@ module.exports.tests.functional = function(test, common){
71
71
  module.exports.tests.synonyms = function(test, common){
72
72
  test( 'synonyms', function(t){
73
73
 
74
- var suite = new elastictest.Suite( common.clientOpts, common.create );
74
+ var suite = new Suite( common.clientOpts, common.create );
75
75
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
76
76
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
77
77
 
@@ -98,7 +98,7 @@ module.exports.tests.synonyms = function(test, common){
98
98
  module.exports.tests.tokenizer = function(test, common){
99
99
  test( 'tokenizer', function(t){
100
100
 
101
- var suite = new elastictest.Suite( common.clientOpts, common.create );
101
+ var suite = new Suite( common.clientOpts, common.create );
102
102
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
103
103
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
104
104
 
@@ -126,7 +126,7 @@ module.exports.tests.tokenizer = function(test, common){
126
126
  module.exports.tests.unicode = function(test, common){
127
127
  test( 'normalization', function(t){
128
128
 
129
- var suite = new elastictest.Suite( common.clientOpts, common.create );
129
+ var suite = new Suite( common.clientOpts, common.create );
130
130
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasAdmin' );
131
131
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
132
132
 
@@ -1,7 +1,7 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
3
  var tape = require('tape'),
4
- elastictest = require('elastictest'),
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 elastictest.Suite( common.clientOpts, common.create );
12
+ var suite = new Suite( common.clientOpts, common.create );
13
13
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasHousenumber' );
14
14
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
15
15
 
@@ -23,7 +23,7 @@ module.exports.tests.analyze = function(test, common){
23
23
  module.exports.tests.functional = function(test, common){
24
24
  test( 'functional', function(t){
25
25
 
26
- var suite = new elastictest.Suite( common.clientOpts, common.create );
26
+ var suite = new Suite( common.clientOpts, common.create );
27
27
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasHousenumber' );
28
28
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
29
29
 
@@ -1,7 +1,7 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
3
  var tape = require('tape'),
4
- elastictest = require('elastictest'),
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 elastictest.Suite( common.clientOpts, common.create );
12
+ var suite = new Suite( common.clientOpts, common.create );
13
13
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
14
14
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
15
15
 
@@ -95,7 +95,7 @@ module.exports.tests.analyze = function(test, common){
95
95
  module.exports.tests.address_suffix_expansions = function(test, common){
96
96
  test( 'address suffix expansions', function(t){
97
97
 
98
- var suite = new elastictest.Suite( common.clientOpts, common.create );
98
+ var suite = new Suite( common.clientOpts, common.create );
99
99
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
100
100
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
101
101
 
@@ -125,7 +125,7 @@ module.exports.tests.address_suffix_expansions = function(test, common){
125
125
  module.exports.tests.stop_words = function(test, common){
126
126
  test( 'stop words', function(t){
127
127
 
128
- var suite = new elastictest.Suite( common.clientOpts, common.create );
128
+ var suite = new Suite( common.clientOpts, common.create );
129
129
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
130
130
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
131
131
 
@@ -146,7 +146,7 @@ module.exports.tests.stop_words = function(test, common){
146
146
  module.exports.tests.functional = function(test, common){
147
147
  test( 'functional', function(t){
148
148
 
149
- var suite = new elastictest.Suite( common.clientOpts, common.create );
149
+ var suite = new Suite( common.clientOpts, common.create );
150
150
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
151
151
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
152
152
 
@@ -172,7 +172,7 @@ module.exports.tests.functional = function(test, common){
172
172
  module.exports.tests.unique = function(test, common){
173
173
  test( 'unique', function(t){
174
174
 
175
- var suite = new elastictest.Suite( common.clientOpts, common.create );
175
+ var suite = new Suite( common.clientOpts, common.create );
176
176
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
177
177
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
178
178
 
@@ -186,7 +186,7 @@ module.exports.tests.unique = function(test, common){
186
186
  module.exports.tests.address = function(test, common){
187
187
  test( 'address', function(t){
188
188
 
189
- var suite = new elastictest.Suite( common.clientOpts, common.create );
189
+ var suite = new Suite( common.clientOpts, common.create );
190
190
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
191
191
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
192
192
 
@@ -218,7 +218,7 @@ module.exports.tests.address = function(test, common){
218
218
  module.exports.tests.unicode = function(test, common){
219
219
  test( 'normalization', function(t){
220
220
 
221
- var suite = new elastictest.Suite( common.clientOpts, common.create );
221
+ var suite = new Suite( common.clientOpts, common.create );
222
222
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasIndexOneEdgeGram' );
223
223
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
224
224
 
@@ -1,6 +1,6 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
- const elastictest = require('elastictest');
3
+ const Suite = require('../test/elastictest/Suite');
4
4
  const punctuation = require('../punctuation');
5
5
  const config = require('pelias-config').generate();
6
6
  const getTotalHits = require('./_hits_total_helper');
@@ -10,7 +10,7 @@ module.exports.tests = {};
10
10
  module.exports.tests.analyze = function(test, common){
11
11
  test( 'analyze', function(t){
12
12
 
13
- var suite = new elastictest.Suite( common.clientOpts, common.create );
13
+ var suite = new Suite( common.clientOpts, common.create );
14
14
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
15
15
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
16
16
 
@@ -62,7 +62,7 @@ module.exports.tests.analyze = function(test, common){
62
62
  module.exports.tests.functional = function(test, common){
63
63
  test( 'functional', function(t){
64
64
 
65
- var suite = new elastictest.Suite( common.clientOpts, common.create );
65
+ var suite = new Suite( common.clientOpts, common.create );
66
66
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
67
67
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
68
68
 
@@ -109,7 +109,7 @@ module.exports.tests.functional = function(test, common){
109
109
  module.exports.tests.tokenizer = function(test, common){
110
110
  test( 'tokenizer', function(t){
111
111
 
112
- var suite = new elastictest.Suite( common.clientOpts, common.create );
112
+ var suite = new Suite( common.clientOpts, common.create );
113
113
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
114
114
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
115
115
 
@@ -135,7 +135,7 @@ module.exports.tests.tokenizer = function(test, common){
135
135
  module.exports.tests.slop = function(test, common){
136
136
  test( 'slop', function(t){
137
137
 
138
- var suite = new elastictest.Suite( common.clientOpts, common.create );
138
+ var suite = new Suite( common.clientOpts, common.create );
139
139
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
140
140
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
141
141
 
@@ -153,7 +153,7 @@ module.exports.tests.slop = function(test, common){
153
153
  module.exports.tests.slop_query = function(test, common){
154
154
  test( 'slop query', function(t){
155
155
 
156
- var suite = new elastictest.Suite( common.clientOpts, common.create );
156
+ var suite = new Suite( common.clientOpts, common.create );
157
157
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
158
158
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
159
159
 
@@ -249,7 +249,7 @@ module.exports.tests.slop_query = function(test, common){
249
249
  module.exports.tests.slop = function(test, common){
250
250
  test( 'slop', function(t){
251
251
 
252
- var suite = new elastictest.Suite( common.clientOpts, common.create );
252
+ var suite = new Suite( common.clientOpts, common.create );
253
253
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
254
254
 
255
255
  // index a document
@@ -293,7 +293,7 @@ module.exports.tests.slop = function(test, common){
293
293
  module.exports.tests.unicode = function(test, common){
294
294
  test( 'normalization', function(t){
295
295
 
296
- var suite = new elastictest.Suite( common.clientOpts, common.create );
296
+ var suite = new Suite( common.clientOpts, common.create );
297
297
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasPhrase' );
298
298
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
299
299
 
@@ -1,7 +1,7 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
3
  var tape = require('tape'),
4
- elastictest = require('elastictest'),
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 elastictest.Suite( common.clientOpts, common.create );
12
+ var suite = new Suite( common.clientOpts, common.create );
13
13
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
14
14
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
15
15
 
@@ -41,7 +41,7 @@ module.exports.tests.analyze = function(test, common){
41
41
  module.exports.tests.functional = function(test, common){
42
42
  test( 'functional', function(t){
43
43
 
44
- var suite = new elastictest.Suite( common.clientOpts, common.create );
44
+ var suite = new Suite( common.clientOpts, common.create );
45
45
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
46
46
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
47
47
 
@@ -56,7 +56,7 @@ module.exports.tests.functional = function(test, common){
56
56
  module.exports.tests.address = function(test, common){
57
57
  test( 'address', function(t){
58
58
 
59
- var suite = new elastictest.Suite( common.clientOpts, common.create );
59
+ var suite = new Suite( common.clientOpts, common.create );
60
60
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
61
61
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
62
62
 
@@ -80,7 +80,7 @@ module.exports.tests.address = function(test, common){
80
80
  module.exports.tests.unicode = function(test, common){
81
81
  test( 'normalization', function(t){
82
82
 
83
- var suite = new elastictest.Suite( common.clientOpts, common.create );
83
+ var suite = new Suite( common.clientOpts, common.create );
84
84
  var assertAnalysis = common.analyze.bind( null, suite, t, 'peliasQuery' );
85
85
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
86
86
 
@@ -1,12 +1,12 @@
1
1
  // validate analyzer is behaving as expected
2
- const elastictest = require('elastictest')
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite(common.clientOpts, common.create );
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
- elastictest = require('elastictest'),
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest.Suite( common.clientOpts, common.create );
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 elastictest = require('elastictest');
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,7 +14,7 @@ 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 elastictest.Suite( common.clientOpts, common.create );
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)
@@ -55,7 +55,7 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm
55
55
  // module.exports.tests.index_contracted_form_search_expanded = function(test, common){
56
56
  // test( 'index contracted and search expanded', function(t){
57
57
 
58
- // var suite = new elastictest.Suite( common.clientOpts, common.create );
58
+ // var suite = new Suite( common.clientOpts, common.create );
59
59
  // suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
60
60
 
61
61
  // // index a document with a name which contains a synonym (center)
@@ -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 elastictest = require('elastictest');
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,7 +14,7 @@ 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 elastictest.Suite( common.clientOpts, common.create );
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)
@@ -71,7 +71,7 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
71
71
  module.exports.tests.index_and_retrieve_contracted_form = function(test, common){
72
72
  test( 'index and retrieve contracted form', function(t){
73
73
 
74
- var suite = new elastictest.Suite( common.clientOpts, common.create );
74
+ var suite = new Suite( common.clientOpts, common.create );
75
75
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
76
76
 
77
77
  // index a document with a name which contains a synonym (center)
@@ -110,7 +110,7 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
110
110
  module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
111
111
  test( 'index and retrieve mixed form 1', function(t){
112
112
 
113
- var suite = new elastictest.Suite( common.clientOpts, common.create );
113
+ var suite = new Suite( common.clientOpts, common.create );
114
114
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
115
115
 
116
116
  // index a document with a name which contains a synonym (center)
@@ -167,7 +167,7 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
167
167
  module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
168
168
  test( 'index and retrieve mixed form 2', function(t){
169
169
 
170
- var suite = new elastictest.Suite( common.clientOpts, common.create );
170
+ var suite = new Suite( common.clientOpts, common.create );
171
171
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
172
172
 
173
173
  // index a document with a name which contains a synonym (center)
@@ -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 elastictest = require('elastictest');
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,7 +15,7 @@ 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 elastictest.Suite( common.clientOpts, common.create );
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)
@@ -72,7 +72,7 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){
72
72
  module.exports.tests.index_and_retrieve_contracted_form = function(test, common){
73
73
  test( 'index and retrieve contracted form', function(t){
74
74
 
75
- var suite = new elastictest.Suite( common.clientOpts, common.create );
75
+ var suite = new Suite( common.clientOpts, common.create );
76
76
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
77
77
 
78
78
  // index a document with a name which contains a synonym (center)
@@ -111,7 +111,7 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common)
111
111
  module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
112
112
  test( 'index and retrieve mixed form 1', function(t){
113
113
 
114
- var suite = new elastictest.Suite( common.clientOpts, common.create );
114
+ var suite = new Suite( common.clientOpts, common.create );
115
115
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
116
116
 
117
117
  // index a document with a name which contains a synonym (center)
@@ -168,7 +168,7 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){
168
168
  module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){
169
169
  test( 'index and retrieve mixed form 2', function(t){
170
170
 
171
- var suite = new elastictest.Suite( common.clientOpts, common.create );
171
+ var suite = new Suite( common.clientOpts, common.create );
172
172
  suite.action( function( done ){ setTimeout( done, 500 ); }); // wait for es to bring some shards up
173
173
 
174
174
  // index a document with a name which contains a synonym (center)
@@ -1,6 +1,6 @@
1
1
  // validate bounding box behaves as expected
2
2
 
3
- const elastictest = require('elastictest');
3
+ const Suite = require('../test/elastictest/Suite');
4
4
  const config = require('pelias-config').generate();
5
5
 
6
6
  module.exports.tests = {};
@@ -8,7 +8,7 @@ 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 elastictest.Suite( common.clientOpts, common.create );
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
@@ -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 elastictest = require('elastictest');
3
+ const Suite = require('../test/elastictest/Suite');
4
4
  const config = require('pelias-config').generate();
5
5
 
6
6
  module.exports.tests = {};
@@ -31,7 +31,7 @@ module.exports.all = function (tape, common) {
31
31
  function nameAssertion( analyzer, common ){
32
32
  return function(t){
33
33
 
34
- var suite = new elastictest.Suite( common.clientOpts, common.create );
34
+ var suite = new Suite( common.clientOpts, common.create );
35
35
  const _type = config.schema.typeName;
36
36
 
37
37
  // index a document from a normal document layer
@@ -70,7 +70,7 @@ function nameAssertion( analyzer, common ){
70
70
  function phraseAssertion( analyzer, common ){
71
71
  return function(t){
72
72
 
73
- const suite = new elastictest.Suite( common.clientOpts, common.create );
73
+ const suite = new Suite( common.clientOpts, common.create );
74
74
  const _type = config.schema.typeName;
75
75
 
76
76
  // index a document from a normal document layer
@@ -109,7 +109,7 @@ function phraseAssertion( analyzer, common ){
109
109
  function addendumAssertion( namespace, value, common ){
110
110
  return function(t){
111
111
 
112
- const suite = new elastictest.Suite( common.clientOpts, common.create );
112
+ const suite = new Suite( common.clientOpts, common.create );
113
113
  const _type = config.schema.typeName;
114
114
 
115
115
  // index a document including the addendum
@@ -1,6 +1,6 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
- const elastictest = require('elastictest');
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 elastictest.Suite(common.clientOpts, common.create);
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
@@ -1,6 +1,6 @@
1
1
  // validate analyzer is behaving as expected
2
2
 
3
- const elastictest = require('elastictest');
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,7 +9,7 @@ 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 elastictest.Suite( common.clientOpts, common.create );
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
@@ -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 elastictest = require('elastictest');
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 elastictest.Suite( common.clientOpts, common.create );
11
+ var suite = new Suite( common.clientOpts, common.create );
12
12
 
13
13
  suite.assert( done => {
14
14
  suite.client.info({}, ( err, res, status ) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pelias-schema",
3
- "version": "6.6.0",
3
+ "version": "6.8.0",
4
4
  "author": "pelias",
5
5
  "description": "Elasticsearch schema files and tooling for Pelias",
6
6
  "homepage": "https://github.com/pelias/schema",
@@ -39,10 +39,11 @@
39
39
  "semver": "^7.1.1"
40
40
  },
41
41
  "devDependencies": {
42
+ "async": "^3.2.5",
42
43
  "difflet": "^1.0.1",
43
- "elastictest": "^3.0.0",
44
44
  "iso3166-1": "^0.5.1",
45
45
  "proxyquire": "^2.0.0",
46
+ "randomstring": "^1.3.0",
46
47
  "tap-spec": "^5.0.0",
47
48
  "tape": "^5.0.0"
48
49
  },
@@ -0,0 +1,103 @@
1
+ const _ = require('lodash')
2
+ const randomstring = require('randomstring')
3
+ const elasticsearch = require('elasticsearch')
4
+ const async = require('async')
5
+
6
+ function Suite (clientOpts, props) {
7
+ this.actions = []
8
+ this.asserts = []
9
+ this.client = null
10
+ this.clientOpts = !!clientOpts && (clone(clientOpts) || {
11
+ host: 'localhost:9200',
12
+ keepAlive: true
13
+ })
14
+ this.props = props || {}
15
+ if (!_.has(this, 'props.index')) {
16
+ this.props.index = 'testindex-' + randomstring.generate(7).toLowerCase()
17
+ }
18
+ }
19
+
20
+ Suite.prototype.action = function (action) {
21
+ this.actions.push(action)
22
+ }
23
+
24
+ Suite.prototype.assert = function (assert) {
25
+ this.asserts.push(assert)
26
+ }
27
+
28
+ Suite.prototype.start = function (cb) {
29
+ this.client = new elasticsearch.Client(this.clientOpts)
30
+ cb()
31
+ }
32
+
33
+ Suite.prototype.create = function (cb) {
34
+ const cmd = _.merge(this.props.create, { index: this.props.index })
35
+ if (_.has(this, 'props.schema')) {
36
+ cmd.body = this.props.schema
37
+ }
38
+ this.client.indices.create(cmd, cb)
39
+ }
40
+
41
+ Suite.prototype.delete = function (cb) {
42
+ const cmd = _.merge(this.props.delete, { index: this.props.index })
43
+ this.client.indices.delete(cmd, cb)
44
+ }
45
+
46
+ Suite.prototype.refresh = function (cb) {
47
+ const cmd = _.merge(this.props.refresh, { index: this.props.index })
48
+ this.client.indices.refresh(cmd, cb)
49
+ }
50
+
51
+ // note: optimize was replaced in version ES@2.0, forcemerge used for later versions:
52
+ // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html
53
+ Suite.prototype.optimize = function (cb) {
54
+ try {
55
+ this.client.indices.forcemerge({ index: this.props.index }, cb)
56
+ } catch (e) {
57
+ const cmd = { index: this.props.index, waitForMerge: true, force: true }
58
+ this.client.indices.optimize(cmd, cb)
59
+ }
60
+ }
61
+
62
+ Suite.prototype.waitForStatus = function (status, cb) {
63
+ const cmd = { waitForStatus: status || 'yellow' }
64
+ this.client.cluster.health(cmd, cb)
65
+ }
66
+
67
+ Suite.prototype.run = function (cb) {
68
+ const self = this
69
+ self.start(err => {
70
+ if (err) { throw new Error(err) }
71
+ self.waitForStatus('yellow', err => {
72
+ if (err) { throw new Error(err) }
73
+ self.create(err => {
74
+ if (err) { throw new Error(err) }
75
+ async.series(self.actions, err => {
76
+ if (err) { throw new Error(err) }
77
+ self.refresh(err => {
78
+ if (err) { throw new Error(err) }
79
+ self.optimize(async.series(self.asserts, err => {
80
+ if (err) { throw new Error(err) }
81
+ self.delete(err => {
82
+ if (err) { throw new Error(err) }
83
+ self.client.close()
84
+ if (_.isFunction(cb)) {
85
+ cb()
86
+ }
87
+ })
88
+ }))
89
+ })
90
+ })
91
+ })
92
+ })
93
+ })
94
+ }
95
+
96
+ // elasticsearch client requires that config objects not be reused.
97
+ // Error: Do not reuse objects to configure the elasticsearch Client class:
98
+ // https://github.com/elasticsearch/elasticsearch-js/issues/33
99
+ function clone (obj) {
100
+ return JSON.parse(JSON.stringify(obj))
101
+ }
102
+
103
+ module.exports = Suite