}
}
if ($aSearch['sCountryCode']) $aTerms[] = "country_code = '".pg_escape_string($aSearch['sCountryCode'])."'";
- if ($aSearch['sHouseNumber']) $aTerms[] = "address_rank in (26,27)";
+ if ($aSearch['sHouseNumber']) $aTerms[] = "address_rank between 22 and 27";
if ($aSearch['fLon'] && $aSearch['fLat'])
{
$aTerms[] = "ST_DWithin(centroid, ST_SetSRID(ST_Point(".$aSearch['fLon'].",".$aSearch['fLat']."),4326), ".$aSearch['fRadius'].")";
$aPlaceIDs = $oDB->getCol($sSQL);
// If not try the aux fallback table
+ /*
if (!sizeof($aPlaceIDs))
{
$sSQL = "select place_id from location_property_aux where parent_place_id in (".$sPlaceIDs.") and housenumber = '".pg_escape_string($aSearch['sHouseNumber'])."'";
if (CONST_Debug) var_dump($sSQL);
$aPlaceIDs = $oDB->getCol($sSQL);
}
+ */
if (!sizeof($aPlaceIDs))
{
$sSQL .= "and 30 between $iMinAddressRank and $iMaxAddressRank ";
$sSQL .= "group by place_id";
if (!$bDeDupe) $sSQL .= ",place_id";
+ /*
$sSQL .= " union ";
$sSQL .= "select 'L' as osm_type,place_id as osm_id,'place' as class,'house' as type,null as admin_level,30 as rank_search,30 as rank_address,min(place_id) as place_id,'us' as country_code,";
$sSQL .= "get_address_by_language(place_id, $sLanguagePrefArraySQL) as langaddress,";
$sSQL .= ",get_address_by_language(place_id, $sLanguagePrefArraySQL) ";
$sSQL .= "order by importance desc";
//$sSQL .= "order by rank_search,rank_address,porder asc";
+ */
if (CONST_Debug) { echo "<hr>"; var_dump($sSQL); }
$aSearchResults = $oDB->getAll($sSQL);
//var_dump($sSQL,$aSearchResults);exit;
$sSQL .= "and 30 between $iMinAddressRank and $iMaxAddressRank ";
$sSQL .= "group by place_id";
if (!$bDeDupe) $sSQL .= ",place_id";
+ /*
$sSQL .= " union ";
$sSQL .= "select 'L' as osm_type,place_id as osm_id,'place' as class,'house' as type,null as admin_level,30 as rank_search,30 as rank_address,min(place_id) as place_id,'us' as country_code,";
$sSQL .= "get_address_by_language(place_id, $sLanguagePrefArraySQL) as langaddress,";
$sSQL .= ",get_address_by_language(place_id, $sLanguagePrefArraySQL) ";
$sSQL .= "order by importance desc";
//$sSQL .= "order by rank_search,rank_address,porder asc";
+ */
if (CONST_Debug) { echo "<hr>", var_dump($sSQL); }
$aSearchResults = $oDB->getAll($sSQL);
//var_dump($sSQL,$aSearchResults);exit;