]> granicus.if.org Git - postgis/commitdiff
#2899 geocode limit 1 not always returning best answer
authorRegina Obe <lr@pcorp.us>
Sat, 23 Aug 2014 05:31:33 +0000 (05:31 +0000)
committerRegina Obe <lr@pcorp.us>
Sat, 23 Aug 2014 05:31:33 +0000 (05:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12914 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2011/geocode/geocode_address.sql
extras/tiger_geocoder/tiger_2011/regress/geocode_regress
extras/tiger_geocoder/tiger_2011/regress/geocode_regress.sql

index 1e74da877c5156bae71abc2dd0c6a8dd806e856f..333e265f66e7babb939d991118c0035146e75a17 100644 (file)
@@ -177,7 +177,7 @@ BEGIN
             ) AS sub 
           JOIN state s ON ($10 = s.statefp) 
             ORDER BY 1,2,3,4,5,6,7,9 
-          LIMIT 20) As foo ORDER BY sub_rating, exact_address DESC LIMIT  ' || max_results ;
+          LIMIT 20) As foo ORDER BY sub_rating, exact_address DESC LIMIT  ' || max_results*10 ;
          
   IF var_debug THEN
          RAISE NOTICE 'stmt: %', 
@@ -235,7 +235,7 @@ BEGIN
             RETURN;
         END IF;
     
-        IF var_n >= max_results  THEN --we have exceeded our desired limit
+        IF var_n >= max_results AND RATING < 10  THEN --we have exceeded our desired limit and rating is not horrible
             RETURN;
         END IF;
     
index 2f8f6d38684929b1ab1c4edc501fcbb56208b42e..3d3dc78dba2e765b93cce63f839c70a61328dda4 100644 (file)
@@ -80,3 +80,4 @@ T18b|26 Court St, Boston, MA 02108|POINT(-71.05885 42.35911)|1
 #1392a|State Hwy 121, Coppell, TX|POINT(-96.993397 32.985954)|8
 #1392b|State Hwy 121, Coppell, TX|POINT(-96.993416 32.987025)|18
 #1392b|State Hwy 121, Coppell, TX|POINT(-96.993397 32.985954)|18
+#2899|POINT(-72.4863 41.2807)|0
index c7c7556c31638c6cd7c212caf734327a17d6ebab..a9f939c439b5ba36513349b225ec693d32d60bd4 100644 (file)
@@ -103,4 +103,7 @@ SELECT '#1333b' AS ticket, pprint_addy(addy), st_astext(geomout),rating FROM geo
 SELECT '#1392a' AS ticket, pprint_addy(addy), st_astext(geomout),rating FROM geocode_intersection('State Hwy 121', 'N Denton Tap Rd', 'TX', 'Coppell', '', 2);
 SELECT '#1392b' AS ticket, pprint_addy(addy), st_astext(geomout),rating FROM geocode_intersection('State Hwy 121', 'N Denton Tap Rd', 'TX','', '', 2);
 --
+
+-- Geocode 1 not returning best answer
+SELECT '#2899' AS ticket, st_astext(ST_SnapToGrid(geomout,0.0001)),rating FROM geocode('22 Minnow Ln, Westbrook, CT 06498',1);
 \timing