mirror of https://github.com/pelias/api.git
Julian Simioni
8 years ago
committed by
GitHub
5 changed files with 145 additions and 1 deletions
@ -0,0 +1,37 @@
|
||||
|
||||
#> focus point |
||||
path: '/v1/autocomplete?text=cairo&boundary.rect.min_lat=30&boundary.rect.max_lat=32&boundary.rect.min_lon=29&boundary.rect.max_lon=31' |
||||
|
||||
#? 200 ok |
||||
response.statusCode.should.be.equal 200 |
||||
response.should.have.header 'charset', 'utf8' |
||||
response.should.have.header 'content-type', 'application/json; charset=utf-8' |
||||
|
||||
#? valid geocoding block |
||||
should.exist json.geocoding |
||||
should.exist json.geocoding.version |
||||
should.exist json.geocoding.attribution |
||||
should.exist json.geocoding.query |
||||
should.exist json.geocoding.engine |
||||
should.exist json.geocoding.engine.name |
||||
should.exist json.geocoding.engine.author |
||||
should.exist json.geocoding.engine.version |
||||
should.exist json.geocoding.timestamp |
||||
|
||||
#? valid geojson |
||||
json.type.should.be.equal 'FeatureCollection' |
||||
json.features.should.be.instanceof Array |
||||
|
||||
#? expected errors |
||||
should.not.exist json.geocoding.errors |
||||
|
||||
#? expected warnings |
||||
should.not.exist json.geocoding.warnings |
||||
|
||||
#? inputs |
||||
json.geocoding.query['text'].should.eql 'cairo' |
||||
json.geocoding.query['size'].should.eql 10 |
||||
json.geocoding.query['boundary.rect.min_lat'].should.eql 30 |
||||
json.geocoding.query['boundary.rect.max_lat'].should.eql 32 |
||||
json.geocoding.query['boundary.rect.min_lon'].should.eql 29 |
||||
json.geocoding.query['boundary.rect.max_lon'].should.eql 31 |
@ -0,0 +1,71 @@
|
||||
module.exports = { |
||||
'query': { |
||||
'bool': { |
||||
'must': [{ |
||||
'constant_score': { |
||||
'query': { |
||||
'match': { |
||||
'name.default': { |
||||
'analyzer': 'peliasQueryPartialToken', |
||||
'boost': 100, |
||||
'query': 'test', |
||||
'type': 'phrase', |
||||
'operator': 'and', |
||||
'slop': 3 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}], |
||||
'should':[{ |
||||
'function_score': { |
||||
'query': { |
||||
'match_all': {} |
||||
}, |
||||
'max_boost': 20, |
||||
'score_mode': 'first', |
||||
'boost_mode': 'replace', |
||||
'functions': [{ |
||||
'field_value_factor': { |
||||
'modifier': 'log1p', |
||||
'field': 'popularity', |
||||
'missing': 1 |
||||
}, |
||||
'weight': 1 |
||||
}] |
||||
} |
||||
},{ |
||||
'function_score': { |
||||
'query': { |
||||
'match_all': {} |
||||
}, |
||||
'max_boost': 20, |
||||
'score_mode': 'first', |
||||
'boost_mode': 'replace', |
||||
'functions': [{ |
||||
'field_value_factor': { |
||||
'modifier': 'log1p', |
||||
'field': 'population', |
||||
'missing': 1 |
||||
}, |
||||
'weight': 3 |
||||
}] |
||||
} |
||||
}], |
||||
'filter': [{ |
||||
'geo_bounding_box': { |
||||
'type': 'indexed', |
||||
'center_point': { |
||||
'top': 37.83239, |
||||
'right': -122.35698, |
||||
'bottom': 37.70808, |
||||
'left': -122.51489 |
||||
} |
||||
} |
||||
}] |
||||
} |
||||
}, |
||||
'sort': [ '_score' ], |
||||
'size': 20, |
||||
'track_scores': true |
||||
}; |
Loading…
Reference in new issue