]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-sql/functions/address_lookup.sql
add a small penalty to lookups in address vectors
[nominatim.git] / lib-sql / functions / address_lookup.sql
index 0eada6987e7db285f9418642ccc5280bd649811a..2bbfcd5c03c6296ff06191a00571c7b11f5da25a 100644 (file)
@@ -320,6 +320,11 @@ BEGIN
     location := ROW(null, null, null, hstore('ref', place.postcode), 'place',
                     'postcode', null, null, false, true, 5, 0)::addressline;
     RETURN NEXT location;
     location := ROW(null, null, null, hstore('ref', place.postcode), 'place',
                     'postcode', null, null, false, true, 5, 0)::addressline;
     RETURN NEXT location;
+  ELSEIF place.address is not null and place.address ? 'postcode'
+         and not place.address->'postcode' SIMILAR TO '%(,|;)%' THEN
+    location := ROW(null, null, null, hstore('ref', place.address->'postcode'), 'place',
+                    'postcode', null, null, false, true, 5, 0)::addressline;
+    RETURN NEXT location;
   END IF;
 
   RETURN;
   END IF;
 
   RETURN;