X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/80ea13437df4c6d57ea503adbdfc9928de8d859c..6dbec931f58c659075a903db1e8eab15b1c93b03:/nominatim/tokenizer/sanitizers/clean_postcodes.py?ds=sidebyside diff --git a/nominatim/tokenizer/sanitizers/clean_postcodes.py b/nominatim/tokenizer/sanitizers/clean_postcodes.py index fbc46fa5..05e90ca1 100644 --- a/nominatim/tokenizer/sanitizers/clean_postcodes.py +++ b/nominatim/tokenizer/sanitizers/clean_postcodes.py @@ -15,6 +15,10 @@ Arguments: postcode centroids of a country but is still searchable. When set to 'no', non-conforming postcodes are not searchable either. + default-pattern: Pattern to use, when there is none available for the + country in question. Warning: will not be used for + objects that have no country assigned. These are always + assumed to have no postcode. """ from nominatim.data.postcode_format import PostcodeFormatter @@ -57,7 +61,8 @@ class _PostcodeSanitizer: if match is None: return None - return self.matcher.normalize(country, match), ' '.join(match.groups()) + return self.matcher.normalize(country, match),\ + ' '.join(filter(lambda p: p is not None, match.groups()))