]> git.openstreetmap.org Git - nominatim.git/blobdiff - src/nominatim_api/search/db_searches.py
fix backward compatibility issues with Python 3.7
[nominatim.git] / src / nominatim_api / search / db_searches.py
index f5c431460d6a34677d37c645e32c047c60c753ac..d2202b2ccfb827d737f19af6aae574ecdb69e622 100644 (file)
@@ -12,9 +12,9 @@ import abc
 
 import sqlalchemy as sa
 
 
 import sqlalchemy as sa
 
-from nominatim_core.typing import SaFromClause, SaScalarSelect, SaColumn, \
-                                  SaExpression, SaSelect, SaLambdaSelect, SaRow, SaBind
-from nominatim_core.db.sqlalchemy_types import Geometry, IntArray
+from ..typing import SaFromClause, SaScalarSelect, SaColumn, \
+                     SaExpression, SaSelect, SaLambdaSelect, SaRow, SaBind
+from ..sql.sqlalchemy_types import Geometry, IntArray
 from ..connection import SearchConnection
 from ..types import SearchDetails, DataLayer, GeometryFormat, Bbox
 from .. import results as nres
 from ..connection import SearchConnection
 from ..types import SearchDetails, DataLayer, GeometryFormat, Bbox
 from .. import results as nres
@@ -616,6 +616,8 @@ class PostcodeSearch(AbstractSearch):
 
             for prow in await conn.execute(placex_sql, _details_to_bind_params(details)):
                 result = nres.create_from_placex_row(prow, nres.SearchResult)
 
             for prow in await conn.execute(placex_sql, _details_to_bind_params(details)):
                 result = nres.create_from_placex_row(prow, nres.SearchResult)
+                if result is not None:
+                    result.bbox = Bbox.from_wkb(prow.bbox)
                 break
             else:
                 result = nres.create_from_postcode_row(row, nres.SearchResult)
                 break
             else:
                 result = nres.create_from_postcode_row(row, nres.SearchResult)