]> 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 5de348e77ff646c6618f2e98d222af67ad19468f..2bbfcd5c03c6296ff06191a00571c7b11f5da25a 100644 (file)
@@ -320,9 +320,14 @@ 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;
 $$
   END IF;
 
   RETURN;
 END;
 $$
-LANGUAGE plpgsql STABLE;
\ No newline at end of file
+LANGUAGE plpgsql STABLE;