Merge pull request #6117 from tchak/show-more-results
Improuve commune autocomplete results
This commit is contained in:
commit
6b08de77e3
1 changed files with 7 additions and 0 deletions
|
@ -19,6 +19,13 @@ function buildURL(scope, term) {
|
||||||
return `${api_adresse_url}/search?q=${term}&limit=5`;
|
return `${api_adresse_url}/search?q=${term}&limit=5`;
|
||||||
} else if (scope === 'annuaire-education') {
|
} else if (scope === 'annuaire-education') {
|
||||||
return `${api_education_url}/search?dataset=fr-en-annuaire-education&q=${term}&rows=5`;
|
return `${api_education_url}/search?dataset=fr-en-annuaire-education&q=${term}&rows=5`;
|
||||||
|
} else if (scope === 'communes') {
|
||||||
|
if (isNumeric(term)) {
|
||||||
|
return `${api_geo_url}/communes?codePostal=${term}&limit=5`;
|
||||||
|
}
|
||||||
|
// Avoid hiding similar matches for precise queries (like "Sainte Marie")
|
||||||
|
const limit = term.length > 5 ? 10 : 5;
|
||||||
|
return `${api_geo_url}/communes?nom=${term}&boost=population&limit=${limit}`;
|
||||||
} else if (isNumeric(term)) {
|
} else if (isNumeric(term)) {
|
||||||
const code = term.padStart(2, '0');
|
const code = term.padStart(2, '0');
|
||||||
return `${api_geo_url}/${scope}?code=${code}&limit=5`;
|
return `${api_geo_url}/${scope}?code=${code}&limit=5`;
|
||||||
|
|
Loading…
Add table
Reference in a new issue