X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1787892d32351988231a60b71900c6a623609c54..1e28f2478c6b4c3ba7ca566e4a43a7f5c293ce3c:/lib/PlaceLookup.php?ds=sidebyside diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index bd6fa171..98af69f2 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -169,14 +169,16 @@ class PlaceLookup public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30) { + Debug::newFunction('Place lookup'); + if (empty($aResults)) { return array(); } $aSubSelects = array(); $sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_PLACEX); - if (CONST_Debug) var_dump('PLACEX', $sPlaceIDs); if ($sPlaceIDs) { + Debug::printVar('Ids from placex', $sPlaceIDs); $sSQL = 'SELECT '; $sSQL .= ' osm_type,'; $sSQL .= ' osm_id,'; @@ -246,6 +248,7 @@ class PlaceLookup // postcode table $sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_POSTCODE); if ($sPlaceIDs) { + Debug::printVar('Ids from location_postcode', $sPlaceIDs); $sSQL = 'SELECT'; $sSQL .= " 'P' as osm_type,"; $sSQL .= ' (SELECT osm_id from placex p WHERE p.place_id = lp.parent_place_id) as osm_id,'; @@ -276,6 +279,7 @@ class PlaceLookup if (CONST_Use_US_Tiger_Data) { $sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_TIGER); if ($sPlaceIDs) { + Debug::printVar('Ids from Tiger table', $sPlaceIDs); $sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_TIGER); // Tiger search only if a housenumber was searched and if it was found // (realized through a join) @@ -321,6 +325,7 @@ class PlaceLookup // osmline - interpolated housenumbers $sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_OSMLINE); if ($sPlaceIDs) { + Debug::printVar('Ids from interpolation', $sPlaceIDs); $sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_OSMLINE); // interpolation line search only if a housenumber was searched // (realized through a join) @@ -406,16 +411,13 @@ class PlaceLookup } } - if (CONST_Debug) var_dump($aSubSelects); - if (empty($aSubSelects)) { return array(); } - $aPlaces = chksql( - $this->oDB->getAll(join(' UNION ', $aSubSelects)), - 'Could not lookup place' - ); + $sSQL = join(' UNION ', $aSubSelects); + Debug::printSQL($sSQL); + $aPlaces = chksql($this->oDB->getAll($sSQL), 'Could not lookup place'); $aClassType = getClassTypes(); foreach ($aPlaces as &$aPlace) { @@ -457,7 +459,7 @@ class PlaceLookup $aPlace['addresstype'] = $sAddressType; } - if (CONST_Debug) var_dump($aPlaces); + Debug::printVar('Places', $aPlaces); return $aPlaces; }