Accidentally used the same variable name for 2 things - broken search by class&type

This commit is contained in:
Brian Quinion 2012-11-15 17:27:08 +00:00
parent 04134f380d
commit 9eb5b62382

View File

@ -939,7 +939,7 @@
{ {
$sPlaceIDs = join(',',$aPlaceIDs); $sPlaceIDs = join(',',$aPlaceIDs);
$aResultPlaceIDs = array(); $aClassPlaceIDs = array();
if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'name') if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'name')
{ {
@ -949,7 +949,7 @@
if ($sCountryCodesSQL) $sSQL .= " and country_code in ($sCountryCodesSQL)"; if ($sCountryCodesSQL) $sSQL .= " and country_code in ($sCountryCodesSQL)";
$sSQL .= " order by rank_search asc limit $iLimit"; $sSQL .= " order by rank_search asc limit $iLimit";
if (CONST_Debug) var_dump($sSQL); if (CONST_Debug) var_dump($sSQL);
$aResultPlaceIDs = $oDB->getCol($sSQL); $aClassPlaceIDs = $oDB->getCol($sSQL);
} }
if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'near') // & in if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'near') // & in
@ -967,9 +967,9 @@
if ($iMaxRank < 9 && $bCacheTable) if ($iMaxRank < 9 && $bCacheTable)
{ {
// Try and get a polygon to search in instead // Try and get a polygon to search in instead
$sSQL = "select geometry from placex where place_id in ($sPlaceIDs) and rank_search < $iMaxRank + 5 and st_geometrytype(geometry) in ('ST_Polygon','ST_MultiPolygon') order by rank_search asc limit 1"; $sSQL = "select geometry from placex where place_id in ($sPlaceIDs) and rank_search < $iMaxRank + 5 and st_geometrytype(geometry) in ('ST_Polygon','ST_MultiPolygon') order by rank_search asc limit 1";
if (CONST_Debug) var_dump($sSQL); if (CONST_Debug) var_dump($sSQL);
$sPlaceGeom = $oDB->getOne($sSQL); $sPlaceGeom = $oDB->getOne($sSQL);
} }
if ($sPlaceGeom) if ($sPlaceGeom)
@ -1020,7 +1020,7 @@
if ($iOffset) $sSQL .= " offset $iOffset"; if ($iOffset) $sSQL .= " offset $iOffset";
$sSQL .= " limit $iLimit"; $sSQL .= " limit $iLimit";
if (CONST_Debug) var_dump($sSQL); if (CONST_Debug) var_dump($sSQL);
$aResultPlaceIDs = array_merge($aResultPlaceIDs, $oDB->getCol($sSQL)); $aClassPlaceIDs = array_merge($aClassPlaceIDs, $oDB->getCol($sSQL));
} }
else else
{ {
@ -1042,12 +1042,12 @@
if ($iOffset) $sSQL .= " offset $iOffset"; if ($iOffset) $sSQL .= " offset $iOffset";
$sSQL .= " limit $iLimit"; $sSQL .= " limit $iLimit";
if (CONST_Debug) var_dump($sSQL); if (CONST_Debug) var_dump($sSQL);
$aResultPlaceIDs = array_merge($aResultPlaceIDs, $oDB->getCol($sSQL)); $aClassPlaceIDs = array_merge($aClassPlaceIDs, $oDB->getCol($sSQL));
} }
} }
} }
$aPlaceIDs = $aResultPlaceIDs; $aPlaceIDs = $aClassPlaceIDs;
} }
@ -1066,6 +1066,7 @@
} }
if ($iQueryLoop > 20) break; if ($iQueryLoop > 20) break;
} }
//exit; //exit;
if (isset($aResultPlaceIDs) && sizeof($aResultPlaceIDs)) break; if (isset($aResultPlaceIDs) && sizeof($aResultPlaceIDs)) break;
if ($iGroupLoop > 4) break; if ($iGroupLoop > 4) break;