Skip to content
Snippets Groups Projects
Commit b2b7b5b5 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'fix/autoComplete' into 'dev'

fix(autoComplete) : change api

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server!43
parents 54b0510d 0cb931b4
No related branches found
No related tags found
3 merge requests!46Recette,!45Dev,!43fix(autoComplete) : change api
...@@ -156,40 +156,16 @@ export class StructuresService { ...@@ -156,40 +156,16 @@ export class StructuresService {
* Search structure address based on data search WS * Search structure address based on data search WS
*/ */
public async searchAddress(data: { searchQuery: string }): Promise<AxiosResponse<any>> { public async searchAddress(data: { searchQuery: string }): Promise<AxiosResponse<any>> {
const req = 'https://data.grandlyon.com/api/elasticsearch/_search'; const req =
const queryString = data.searchQuery.trim().replace(/\s/g, ' AND '); 'https://download.data.grandlyon.com/geocoding/photon-bal/api?q=' +
const params = { data.searchQuery +
from: 0, '&lat=45.75&lon=4.85&lang=fr&limit=5&osm_tag=:!construction&osm_tag=:!bus_stop';
size: 30,
_source: ['data-fr'],
query: {
bool: {
filter: {
term: {
'metadata-fr.geonet:info.uuid.keyword': '4cb035de-6ac3-4763-94d8-4c19b1d19607',
},
},
must: [
{
query_string: {
query: queryString,
default_field: '*',
analyzer: 'my_search_analyzer',
fuzziness: 'AUTO',
minimum_should_match: '90%',
},
},
],
},
},
};
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.httpService this.httpService
.request({ .request({
url: req, url: encodeURI(req),
method: 'GET', method: 'GET',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
data: params,
}) })
.subscribe( .subscribe(
(reply) => { (reply) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment