X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/ed7d7a9ad99789dc37268666e7cec94e6b2440e4..d9e0ef0ebfbc2860e7c0b7e7510a4014300074be:/lib/SearchDescription.php diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 35424b52..bf32df96 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -448,11 +448,18 @@ class SearchDescription //now search for housenumber, if housenumber provided if ($this->sHouseNumber && !empty($aResults)) { - $aNamedPlaceIDs = $aResults; - $aResults = $this->queryHouseNumber($oDB, $aNamedPlaceIDs); + // Downgrade the rank of the street results, they are missing + // the housenumber. + foreach ($aResults as $oRes) { + $oRes->iResultRank++; + } + + $aHnResults = $this->queryHouseNumber($oDB, $aResults); - if (empty($aResults) && $this->looksLikeFullAddress()) { - $aResults = $aNamedPlaceIDs; + if (!empty($aHnResults)) { + foreach ($aHnResults as $oRes) { + $aResults[$oRes->iId] = $oRes; + } } } @@ -469,16 +476,13 @@ class SearchDescription if ($sPlaceIds) { $sSQL = 'SELECT place_id FROM placex'; $sSQL .= ' WHERE place_id in ('.$sPlaceIds.')'; - $sSQL .= " AND postcode = '".$this->sPostcode."'"; + $sSQL .= " AND postcode != '".$this->sPostcode."'"; Debug::printSQL($sSQL); $aFilteredPlaceIDs = chksql($oDB->getCol($sSQL)); if ($aFilteredPlaceIDs) { - $aNewResults = array(); foreach ($aFilteredPlaceIDs as $iPlaceId) { - $aNewResults[$iPlaceId] = $aResults[$iPlaceId]; + $aResults[$iPlaceId]->iResultRank++; } - $aResults = $aNewResults; - Debug::printVar('Place IDs after postcode filtering', $aResults); } } } @@ -701,7 +705,7 @@ class SearchDescription } if ($this->sHouseNumber || $this->sClass) { - $iLimit = 20; + $iLimit = 40; } $aResults = array();