enable exact search of GB postcodes in aux postcode data,

partial search still disabled due to performance problems
This commit is contained in:
Sarah Hoffmann
2012-02-11 09:19:42 +00:00
parent 8c7bd6beab
commit e081983bcd
2 changed files with 6 additions and 3 deletions

View File

@@ -179,6 +179,10 @@
return array(array('lat' => $aNearPostcodes[0]['lat'], 'lon' => $aNearPostcodes[0]['lon'], 'radius' => 0.005));
}
return false;
/* partial search disabled because it sequentially scans placex
$sSQL = 'select substring(upper(postcode) from \'^[A-Z][A-Z]?[0-9][0-9A-Z]? [0-9]([A-Z][A-Z])$\'),ST_X(ST_Centroid(geometry)) as lon,ST_Y(ST_Centroid(geometry)) as lat from placex where country_code::text = \'gb\'::text AND substring(postcode from \'^([A-Z][A-Z]?[0-9][0-9A-Z]? [0-9])[A-Z][A-Z]$\') = \''.$sPostcodeSector.'\' and class=\'place\' and type=\'postcode\' ';
$sSQL .= ' union ';
$sSQL .= 'select substring(upper(postcode) from \'^[A-Z][A-Z]?[0-9][0-9A-Z]? [0-9]([A-Z][A-Z])$\'),ST_X(ST_Centroid(geometry)) as lon,ST_Y(ST_Centroid(geometry)) as lat from gb_postcode where substring(postcode from \'^([A-Z][A-Z]?[0-9][0-9A-Z]? [0-9])[A-Z][A-Z]$\') = \''.$sPostcodeSector.'\'';
@@ -217,7 +221,7 @@
return array(array('lat' => $fLat, 'lon' => $fLon, 'radius' => $fRadius));
}
return false;
*/
/*
$fTotalFac is a suprisingly good indicator of accuracy
$iZoom = 18 + round(log($fTotalFac,32));

View File

@@ -354,7 +354,7 @@
}
}
if ($bSuggestion) $sSuggestion = join(', ',$aSuggestion);
/*
// Try and calculate GB postcodes we might be missing
foreach($aTokens as $sToken)
{
@@ -372,7 +372,6 @@
}
}
}
*/
foreach($aTokens as $sToken)
{