]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/api/v1/server_glue.py
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / nominatim / api / v1 / server_glue.py
index d1bcc1dab0d3050bd5ec2a0cad40f1fbad9f0b58..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),
 
     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
                                parented_places=params.get_bool('hierarchy', False),
                                keywords=params.get_bool('keywords', False),
                                geometry_output = napi.GeometryFormat.GEOJSON
@@ -453,17 +453,24 @@ async def search_endpoint(api: napi.NominatimAPIAsync, params: ASGIAdaptor) -> A
     if params.get('featureType', None) is not None:
         details['layers'] = napi.DataLayer.ADDRESS
 
     if params.get('featureType', None) is not None:
         details['layers'] = napi.DataLayer.ADDRESS
 
+    # unstructured query parameters
     query = params.get('q', None)
     query = params.get('q', None)
+    # structured query parameters
     queryparts = {}
     queryparts = {}
+    for key in ('amenity', 'street', 'city', 'county', 'state', 'postalcode', 'country'):
+        details[key] = params.get(key, None)
+        if details[key]:
+            queryparts[key] = details[key]
+
     try:
         if query is not None:
     try:
         if query is not None:
+            if queryparts:
+                params.raise_error("Structured query parameters"
+                                   "(amenity, street, city, county, state, postalcode, country)"
+                                   " cannot be used together with 'q' parameter.")
             queryparts['q'] = query
             results = await _unstructured_search(query, api, details)
         else:
             queryparts['q'] = query
             results = await _unstructured_search(query, api, details)
         else:
-            for key in ('amenity', 'street', 'city', 'county', 'state', 'postalcode', 'country'):
-                details[key] = params.get(key, None)
-                if details[key]:
-                    queryparts[key] = details[key]
             query = ', '.join(queryparts.values())
 
             results = await api.search_address(**details)
             query = ', '.join(queryparts.values())
 
             results = await api.search_address(**details)