]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #3190 from lonvia/fix-internal-server-errors
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 5 Sep 2023 15:00:31 +0000 (17:00 +0200)
committerGitHub <noreply@github.com>
Tue, 5 Sep 2023 15:00:31 +0000 (17:00 +0200)
Fix more failing queries

.github/workflows/ci-tests.yml
nominatim/api/search/db_searches.py
nominatim/api/v1/helpers.py
test/python/api/search/test_search_places.py
test/python/api/test_helpers_v1.py

index 48de6e0d51d50514ad5074f25f671c3c0d2b9e46..1d34ed1ac312edcfd5cf3b5ac9b97fdfb02cbbb3 100644 (file)
@@ -7,7 +7,7 @@ jobs:
         runs-on: ubuntu-latest
 
         steps:
-            - uses: actions/checkout@v3
+            - uses: actions/checkout@v4
               with:
                 submodules: true
 
index e9df3beeb8f12e0951e8196b5f19e31341a4b984..1f7eb0093a6bc8245bbe3b422084e4bcd25d73fd 100644 (file)
@@ -685,7 +685,8 @@ class PlaceSearch(AbstractSearch):
             if self.qualifiers:
                 place_sql = place_sql.where(self.qualifiers.sql_restrict(thnr))
 
-            numerals = [int(n) for n in self.housenumbers.values if n.isdigit()]
+            numerals = [int(n) for n in self.housenumbers.values
+                        if n.isdigit() and len(n) < 8]
             interpol_sql: SaColumn
             tiger_sql: SaColumn
             if numerals and \
index 325e5bc629911dc446476c1499499eb641e741dd..6a646e4f6445116908c97f9f1669c783bc1748c3 100644 (file)
@@ -136,10 +136,10 @@ def _deg(axis:str) -> str:
     return f"(?P<{axis}_deg>\\d+\\.\\d+)°?"
 
 def _deg_min(axis: str) -> str:
-    return f"(?P<{axis}_deg>\\d+)[°\\s]+(?P<{axis}_min>[\\d.]+)?[′']*"
+    return f"(?P<{axis}_deg>\\d+)[°\\s]+(?P<{axis}_min>[\\d.]+)[′']*"
 
 def _deg_min_sec(axis: str) -> str:
-    return f"(?P<{axis}_deg>\\d+)[°\\s]+(?P<{axis}_min>\\d+)[′'\\s]+(?P<{axis}_sec>[\\d.]+)?[\"″]*"
+    return f"(?P<{axis}_deg>\\d+)[°\\s]+(?P<{axis}_min>\\d+)[′'\\s]+(?P<{axis}_sec>[\\d.]+)[\"″]*"
 
 COORD_REGEX = [re.compile(r'(?:(?P<pre>.*?)\s+)??' + r + r'(?:\s+(?P<post>.*))?') for r in (
     r"(?P<ns>[NS])\s*" + _deg('lat') + r"[\s,]+" + r"(?P<ew>[EW])\s*" + _deg('lon'),
index df369b81e1d36f77c65d0c66ea0fb9182a5051e3..8d17ec2da25b7a3d9448b42faa5daa24fcd74ad3 100644 (file)
@@ -267,6 +267,26 @@ class TestStreetWithHousenumber:
         assert all(geom.name.lower() in r.geometry for r in results)
 
 
+def test_very_large_housenumber(apiobj):
+    apiobj.add_placex(place_id=93, class_='place', type='house',
+                      parent_place_id=2000,
+                      housenumber='2467463524544', country_code='pt')
+    apiobj.add_placex(place_id=2000, class_='highway', type='residential',
+                      rank_search=26, rank_address=26,
+                      country_code='pt')
+    apiobj.add_search_name(2000, names=[1,2],
+                           search_rank=26, address_rank=26,
+                           country_code='pt')
+
+    lookup = FieldLookup('name_vector', [1, 2], 'lookup_all')
+
+    results = run_search(apiobj, 0.1, [lookup], [], hnrs=['2467463524544'],
+                         details=SearchDetails())
+
+    assert results
+    assert [r.place_id for r in results] == [93, 2000]
+
+
 class TestInterpolations:
 
     @pytest.fixture(autouse=True)
index 45f538dea34fb777e90d39969b87fba2ab6c489e..e4862b0d807bb4569ff2161807987b76265c557f 100644 (file)
@@ -11,7 +11,11 @@ import pytest
 
 import nominatim.api.v1.helpers as helper
 
-@pytest.mark.parametrize('inp', ['', 'abc', '12 23', 'abc -78.90, 12.456 def'])
+@pytest.mark.parametrize('inp', ['',
+                                 'abc',
+                                 '12 23',
+                                 'abc -78.90, 12.456 def',
+                                 '40 N 60 W'])
 def test_extract_coords_no_coords(inp):
     query, x, y = helper.extract_coords_from_query(inp)