feat: construct search results better

This commit is contained in:
2025-01-09 23:15:10 +01:00
parent a2ef91e89a
commit bc1f4e7ab7
2 changed files with 16 additions and 3 deletions

View File

@@ -4,5 +4,18 @@ function ifdef(variable, prefix = "", suffix = "") {
} else {
return "";
}
}
function geojson_to_summary(location) {
if (ifdef(location.properties.name) !== "") {
return location.properties.name + ifdef(location.properties.city, " (", ")");
} else {
return ifdef(location.properties.street, "", ifdef(location.properties.housenumber, " ","")) + ifdef(location.properties.city, ", ", "") + ifdef(location.properties.countrycode, ", ", "")
}
}
function geojson_to_searchable_string(location) {
return ifdef(location.properties.name, "", ", ") + ifdef(location.properties.street, "", ifdef(location.properties.housenumber, " ","")) + ifdef(location.properties.city, ", ", "") + ifdef(location.properties.country, ", ", "")
}
}