mirror of https://github.com/pelias/api.git
Peter Johnson a.k.a. insertcoffee
9 years ago
25 changed files with 332 additions and 30 deletions
@ -0,0 +1,26 @@
|
||||
machine: |
||||
ruby: |
||||
version: 2.1.2 |
||||
node: |
||||
version: 0.12.2 |
||||
|
||||
dependencies: |
||||
pre: |
||||
- echo "{\"mapzen\":{\"api_key\":{\"search.mapzen.com\":\"$SEARCH_API_KEY\",\"pelias.mapzen.com\":\"$PELIAS_API_KEY\"}}}" >~/pelias.json |
||||
|
||||
deployment: |
||||
prod: |
||||
branch: production |
||||
commands: |
||||
- git clone git@github.com:pelias/acceptance-tests && cd acceptance-tests && npm install |
||||
- git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install |
||||
- cd pelias-deploy && bundle exec rake deploy:api[prod] |
||||
- cd acceptance-tests && npm test -- -e prod |
||||
- cd pelias-deploy && bundle exec rake deploy:api[prod_build] |
||||
dev: |
||||
branch: master |
||||
commands: |
||||
- git clone git@github.com:pelias/acceptance-tests && cd acceptance-tests && npm install |
||||
- git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install |
||||
- cd pelias-deploy && bundle exec rake deploy:api[dev] |
||||
- cd acceptance-tests && npm test -- -e dev |
@ -0,0 +1,95 @@
|
||||
|
||||
var peliasQuery = require('pelias-query'), |
||||
extend = require('extend'); |
||||
|
||||
module.exports = extend( false, peliasQuery.defaults, { |
||||
|
||||
'size': 10, |
||||
'track_scores': true, |
||||
|
||||
'centroid:field': 'center_point', |
||||
|
||||
'sort:distance:order': 'asc', |
||||
'sort:distance:distance_type': 'plane', |
||||
|
||||
'boundary:circle:radius': '50km', |
||||
'boundary:circle:distance_type': 'plane', |
||||
'boundary:circle:optimize_bbox': 'indexed', |
||||
'boundary:circle:_cache': true, |
||||
|
||||
'boundary:rect:type': 'indexed', |
||||
'boundary:rect:_cache': true, |
||||
|
||||
'ngram:analyzer': 'peliasOneEdgeGram', |
||||
'ngram:field': 'name.default', |
||||
'ngram:boost': 1, |
||||
|
||||
'phrase:analyzer': 'peliasPhrase', |
||||
'phrase:field': 'phrase.default', |
||||
'phrase:boost': 1, |
||||
'phrase:slop': 2, |
||||
|
||||
'focus:function': 'linear', |
||||
'focus:offset': '1km', |
||||
'focus:scale': '50km', |
||||
'focus:decay': 0.5, |
||||
'focus:weight': 2, |
||||
|
||||
'function_score:score_mode': 'avg', |
||||
'function_score:boost_mode': 'replace', |
||||
|
||||
'address:housenumber:analyzer': 'peliasHousenumber', |
||||
'address:housenumber:field': 'address.number', |
||||
'address:housenumber:boost': 2, |
||||
|
||||
'address:street:analyzer': 'peliasStreet', |
||||
'address:street:field': 'address.street', |
||||
'address:street:boost': 5, |
||||
|
||||
'address:postcode:analyzer': 'peliasZip', |
||||
'address:postcode:field': 'address.zip', |
||||
'address:postcode:boost': 20, |
||||
|
||||
'admin:alpha3:analyzer': 'standard', |
||||
'admin:alpha3:field': 'alpha3', |
||||
'admin:alpha3:boost': 5, |
||||
|
||||
'admin:admin0:analyzer': 'peliasAdmin', |
||||
'admin:admin0:field': 'admin0', |
||||
'admin:admin0:boost': 4, |
||||
|
||||
'admin:admin1:analyzer': 'peliasAdmin', |
||||
'admin:admin1:field': 'admin1', |
||||
'admin:admin1:boost': 3, |
||||
|
||||
'admin:admin1_abbr:analyzer': 'peliasAdmin', |
||||
'admin:admin1_abbr:field': 'admin1_abbr', |
||||
'admin:admin1_abbr:boost': 3, |
||||
|
||||
'admin:admin2:analyzer': 'peliasAdmin', |
||||
'admin:admin2:field': 'admin2', |
||||
'admin:admin2:boost': 2, |
||||
|
||||
'admin:local_admin:analyzer': 'peliasAdmin', |
||||
'admin:local_admin:field': 'local_admin', |
||||
'admin:local_admin:boost': 1, |
||||
|
||||
'admin:locality:analyzer': 'peliasAdmin', |
||||
'admin:locality:field': 'locality', |
||||
'admin:locality:boost': 1, |
||||
|
||||
'admin:neighborhood:analyzer': 'peliasAdmin', |
||||
'admin:neighborhood:field': 'neighborhood', |
||||
'admin:neighborhood:boost': 1, |
||||
|
||||
'popularity:field': 'popularity', |
||||
'popularity:modifier': 'log1p', |
||||
'popularity:max_boost': 20, |
||||
'popularity:weight': 1, |
||||
|
||||
'population:field': 'population', |
||||
'population:modifier': 'log1p', |
||||
'population:max_boost': 20, |
||||
'population:weight': 2 |
||||
|
||||
}); |
@ -0,0 +1,95 @@
|
||||
|
||||
var peliasQuery = require('pelias-query'), |
||||
extend = require('extend'); |
||||
|
||||
module.exports = extend( false, peliasQuery.defaults, { |
||||
|
||||
'size': 10, |
||||
'track_scores': true, |
||||
|
||||
'centroid:field': 'center_point', |
||||
|
||||
'sort:distance:order': 'asc', |
||||
'sort:distance:distance_type': 'plane', |
||||
|
||||
'boundary:circle:radius': '50km', |
||||
'boundary:circle:distance_type': 'plane', |
||||
'boundary:circle:optimize_bbox': 'indexed', |
||||
'boundary:circle:_cache': true, |
||||
|
||||
'boundary:rect:type': 'indexed', |
||||
'boundary:rect:_cache': true, |
||||
|
||||
'ngram:analyzer': 'peliasOneEdgeGram', |
||||
'ngram:field': 'name.default', |
||||
'ngram:boost': 1, |
||||
|
||||
'phrase:analyzer': 'peliasPhrase', |
||||
'phrase:field': 'phrase.default', |
||||
'phrase:boost': 1, |
||||
'phrase:slop': 2, |
||||
|
||||
'focus:function': 'linear', |
||||
'focus:offset': '1km', |
||||
'focus:scale': '50km', |
||||
'focus:decay': 0.5, |
||||
'focus:weight': 2, |
||||
|
||||
'function_score:score_mode': 'avg', |
||||
'function_score:boost_mode': 'replace', |
||||
|
||||
'address:housenumber:analyzer': 'peliasHousenumber', |
||||
'address:housenumber:field': 'address.number', |
||||
'address:housenumber:boost': 2, |
||||
|
||||
'address:street:analyzer': 'peliasStreet', |
||||
'address:street:field': 'address.street', |
||||
'address:street:boost': 5, |
||||
|
||||
'address:postcode:analyzer': 'peliasZip', |
||||
'address:postcode:field': 'address.zip', |
||||
'address:postcode:boost': 20, |
||||
|
||||
'admin:alpha3:analyzer': 'standard', |
||||
'admin:alpha3:field': 'alpha3', |
||||
'admin:alpha3:boost': 5, |
||||
|
||||
'admin:admin0:analyzer': 'peliasAdmin', |
||||
'admin:admin0:field': 'admin0', |
||||
'admin:admin0:boost': 4, |
||||
|
||||
'admin:admin1:analyzer': 'peliasAdmin', |
||||
'admin:admin1:field': 'admin1', |
||||
'admin:admin1:boost': 3, |
||||
|
||||
'admin:admin1_abbr:analyzer': 'peliasAdmin', |
||||
'admin:admin1_abbr:field': 'admin1_abbr', |
||||
'admin:admin1_abbr:boost': 3, |
||||
|
||||
'admin:admin2:analyzer': 'peliasAdmin', |
||||
'admin:admin2:field': 'admin2', |
||||
'admin:admin2:boost': 2, |
||||
|
||||
'admin:local_admin:analyzer': 'peliasAdmin', |
||||
'admin:local_admin:field': 'local_admin', |
||||
'admin:local_admin:boost': 1, |
||||
|
||||
'admin:locality:analyzer': 'peliasAdmin', |
||||
'admin:locality:field': 'locality', |
||||
'admin:locality:boost': 1, |
||||
|
||||
'admin:neighborhood:analyzer': 'peliasAdmin', |
||||
'admin:neighborhood:field': 'neighborhood', |
||||
'admin:neighborhood:boost': 1, |
||||
|
||||
'popularity:field': 'popularity', |
||||
'popularity:modifier': 'log1p', |
||||
'popularity:max_boost': 20, |
||||
'popularity:weight': 1, |
||||
|
||||
'population:field': 'population', |
||||
'population:modifier': 'log1p', |
||||
'population:max_boost': 20, |
||||
'population:weight': 2 |
||||
|
||||
}); |
@ -1,4 +1,4 @@
|
||||
var parser = require('../../../helper/query_parser'); |
||||
var parser = require('../../../helper/text_parser'); |
||||
|
||||
var type_mapping = require('../../../helper/type_mapping'); |
||||
var layers_map = type_mapping.layer_with_aliases_to_type; |
@ -0,0 +1,22 @@
|
||||
|
||||
var defaults = require('../../../query/autocomplete_defaults'); |
||||
|
||||
module.exports.tests = {}; |
||||
|
||||
module.exports.tests.interface = function(test, common) { |
||||
test('valid interface', function(t) { |
||||
t.equal(typeof defaults, 'object', 'defaults defined'); |
||||
t.end(); |
||||
}); |
||||
}; |
||||
|
||||
module.exports.all = function (tape, common) { |
||||
|
||||
function test(name, testFunction) { |
||||
return tape('autocomplete defaults ' + name, testFunction); |
||||
} |
||||
|
||||
for( var testCase in module.exports.tests ){ |
||||
module.exports.tests[testCase](test, common); |
||||
} |
||||
}; |
@ -0,0 +1,22 @@
|
||||
|
||||
var defaults = require('../../../query/reverse_defaults'); |
||||
|
||||
module.exports.tests = {}; |
||||
|
||||
module.exports.tests.interface = function(test, common) { |
||||
test('valid interface', function(t) { |
||||
t.equal(typeof defaults, 'object', 'defaults defined'); |
||||
t.end(); |
||||
}); |
||||
}; |
||||
|
||||
module.exports.all = function (tape, common) { |
||||
|
||||
function test(name, testFunction) { |
||||
return tape('reverse defaults ' + name, testFunction); |
||||
} |
||||
|
||||
for( var testCase in module.exports.tests ){ |
||||
module.exports.tests[testCase](test, common); |
||||
} |
||||
}; |
@ -0,0 +1,32 @@
|
||||
var sanitiser = require('../../../sanitiser/_text'); |
||||
var type_mapping = require('../../../helper/type_mapping'); |
||||
|
||||
module.exports.tests = {}; |
||||
|
||||
module.exports.tests.text_parser = function(test, common) { |
||||
test('short input text has admin layers set ', function(t) { |
||||
var raw = { |
||||
text: 'emp' //start of empire state building
|
||||
}; |
||||
var clean = { |
||||
}; |
||||
|
||||
var messages = sanitiser(raw, clean); |
||||
|
||||
t.deepEquals(messages.errors, [], 'no errors'); |
||||
t.deepEquals(messages.warnings, [], 'no warnings'); |
||||
t.equal(clean.types.from_text_parser, type_mapping.layer_with_aliases_to_type.coarse, 'coarse layers preferred'); |
||||
|
||||
t.end(); |
||||
}); |
||||
}; |
||||
|
||||
module.exports.all = function (tape, common) { |
||||
function test(name, testFunction) { |
||||
return tape('SANITISER _text: ' + name, testFunction); |
||||
} |
||||
|
||||
for( var testCase in module.exports.tests ){ |
||||
module.exports.tests[testCase](test, common); |
||||
} |
||||
}; |
Loading…
Reference in new issue