]> granicus.if.org Git - postgis/commitdiff
#1051 - fix rating logic (typo in direction weight) causing - select (g.addy).*,...
authorRegina Obe <lr@pcorp.us>
Sat, 25 Jun 2011 08:13:16 +0000 (08:13 +0000)
committerRegina Obe <lr@pcorp.us>
Sat, 25 Jun 2011 08:13:16 +0000 (08:13 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7474 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2010/geocode/rate_attributes.sql

index 187ac4a9314fbd3cb44747b139c059bbc6a99e38..75f03ca0173165b8c4b5250cd02f20c47fcf29c9 100644 (file)
@@ -5,16 +5,18 @@
 -- non-null.  The other eight values are handled by the other rate_attributes
 -- function, so it's requirements must also be met.
 -- changed: 2010-10-18 Regina Obe - all references to verbose to var_verbose since causes compile errors in 9.0
-CREATE OR REPLACE FUNCTION rate_attributes(VARCHAR, VARCHAR, VARCHAR, VARCHAR,
-    VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR, VARCHAR) RETURNS INTEGER
+-- changed: 2011-06-25 revise to use real named args and fix direction rating typo
+CREATE OR REPLACE FUNCTION rate_attributes(dirpA VARCHAR, dirpB VARCHAR, streetNameA VARCHAR, streetNameB VARCHAR,
+    streetTypeA VARCHAR, streetTypeB VARCHAR, dirsA VARCHAR, dirsB VARCHAR,  locationA VARCHAR, locationB VARCHAR) RETURNS INTEGER
 AS $_$
 DECLARE
+--$Id$
   result INTEGER := 0;
   locationWeight INTEGER := 14;
   var_verbose BOOLEAN := FALSE;
 BEGIN
-  IF $9 IS NOT NULL AND $10 IS NOT NULL THEN
-    result := levenshtein_ignore_case($9, $10);
+  IF locationA IS NOT NULL AND locationB IS NOT NULL THEN
+    result := levenshtein_ignore_case(locationA, locationB);
   ELSE
     IF var_verbose THEN
       RAISE NOTICE 'rate_attributes() - Location names cannot be null!';
@@ -31,8 +33,8 @@ $_$ LANGUAGE plpgsql IMMUTABLE;
 -- Rates the street based on the given attributes.  Only streetNames are
 -- required.  If any others are null (either A or B) they are treated as
 -- empty strings.
-CREATE OR REPLACE FUNCTION rate_attributes(VARCHAR, VARCHAR, VARCHAR, VARCHAR,
-    VARCHAR, VARCHAR, VARCHAR, VARCHAR) RETURNS INTEGER
+CREATE OR REPLACE FUNCTION rate_attributes(dirpA VARCHAR, dirpB VARCHAR, streetNameA VARCHAR, streetNameB VARCHAR,
+    streetTypeA VARCHAR, streetTypeB VARCHAR, dirsA VARCHAR, dirsB VARCHAR) RETURNS INTEGER
 AS $_$
 DECLARE
   result INTEGER := 0;
@@ -43,7 +45,7 @@ DECLARE
 BEGIN
   result := result + levenshtein_ignore_case(cull_null($1), cull_null($2)) *
       directionWeight;
-  IF $3 IS NOT NULL AND $4 IS NOT NULL THEN
+  IF streetNameA IS NOT NULL AND streetNameB IS NOT NULL THEN
     result := result + levenshtein_ignore_case($3, $4) * nameWeight;
   ELSE
     IF var_verbose THEN
@@ -51,9 +53,9 @@ BEGIN
     END IF;
     RETURN NULL;
   END IF;
-  result := result + levenshtein_ignore_case(cull_null($5), cull_null($6)) *
+  result := result + levenshtein_ignore_case(cull_null(streetTypeA), cull_null(streetTypeB)) *
       typeWeight;
-  result := result + levenshtein_ignore_case(cull_null($7), cull_null($7)) *
+  result := result + levenshtein_ignore_case(cull_null(dirsA), cull_null(dirsB)) *
       directionWeight;
   return result;
 END;