]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 13 Aug 2023 16:35:25 +0000 (18:35 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 13 Aug 2023 16:35:25 +0000 (18:35 +0200)
nominatim/api/search/db_search_builder.py
nominatim/api/search/db_searches.py
nominatim/api/v1/format.py
nominatim/api/v1/server_glue.py

index 3ed66a42215aca04d5829e0f0e8d8c35cc1af8a8..377c4be7da959b156b19d531ab5e1511fc5be515 100644 (file)
@@ -208,7 +208,7 @@ class SearchBuilder:
                            and all(t.is_indexed for t in addr_partials)
         exp_count = min(t.count for t in name_partials)
 
-        if (len(name_partials) > 3 or exp_count < 1000) and partials_indexed:
+        if (len(name_partials) > 3 or exp_count < 3000) and partials_indexed:
             yield penalty, exp_count, dbf.lookup_by_names(name_tokens, addr_tokens)
             return
 
index 02a45e7c2d4d9f7db707dc3d69f8cc6051691199..115f32fad4d7e307eada70cd02080901fbcacbd6 100644 (file)
@@ -427,6 +427,7 @@ class CountrySearch(AbstractSearch):
             result = nres.create_from_placex_row(row, nres.SearchResult)
             assert result
             result.accuracy = self.penalty + self.countries.get_penalty(row.country_code, 5.0)
+            result.bbox = Bbox.from_wkb(row.bbox)
             results.append(result)
 
         return results or await self.lookup_in_country_table(conn, details)
@@ -638,7 +639,7 @@ class PlaceSearch(AbstractSearch):
                 else:
                     sql = sql.where(tsearch.c.centroid.ST_DWithin_no_index(NEAR_PARAM,
                                                                            NEAR_RADIUS_PARAM))
-            sql = sql.add_columns(-tsearch.c.centroid.ST_Distance(NEAR_PARAM)
+            sql = sql.add_columns((-tsearch.c.centroid.ST_Distance(NEAR_PARAM))
                                       .label('importance'))
             sql = sql.order_by(sa.desc(sa.text('importance')))
         else:
@@ -670,7 +671,7 @@ class PlaceSearch(AbstractSearch):
                           .where(thnr.c.indexed_status == 0)
 
             if details.excluded:
-                place_sql = place_sql.where(_exclude_places(thnr))
+                place_sql = place_sql.where(thnr.c.place_id.not_in(sa.bindparam('excluded')))
             if self.qualifiers:
                 place_sql = place_sql.where(self.qualifiers.sql_restrict(thnr))
 
index 1e37b4c7a6fe191aec67413428aa2ad34b9d27dc..53156fdd41132ada43139546d36ec0e470590858 100644 (file)
@@ -141,7 +141,7 @@ def _format_details_json(result: napi.DetailedResult, options: Mapping[str, Any]
     if result.address_rows is not None:
         _add_address_rows(out, 'address', result.address_rows, locales)
 
-    if result.linked_rows is not None:
+    if result.linked_rows:
         _add_address_rows(out, 'linked_places', result.linked_rows, locales)
 
     if result.name_keywords is not None or result.address_keywords is not None:
index 80bf38a4517b9ea8eee53604a71a088d1ef42ed4..cf9bc3af6ff8d804450319119393184052fe237e 100644 (file)
@@ -302,7 +302,7 @@ async def details_endpoint(api: napi.NominatimAPIAsync, params: ASGIAdaptor) ->
 
     result = await api.details(place,
                                address_details=params.get_bool('addressdetails', False),
-                               linked_places=params.get_bool('linkedplaces', False),
+                               linked_places=params.get_bool('linkedplaces', True),
                                parented_places=params.get_bool('hierarchy', False),
                                keywords=params.get_bool('keywords', False),
                                geometry_output = napi.GeometryFormat.GEOJSON