From 85f32d6c0f47a73bb173a0b2f59b65da734c586c Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 17 Nov 2018 00:35:38 +0100 Subject: [PATCH 1/1] Keep matches without house number Now that we have result ranking, we can keep the street results for housenumber searches and reuse them in the next group round if required. Also fixes an issue where postcode and housenumber are in the query and one of them is wrong. Fixes #1200. --- lib/SearchDescription.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 204a7358..bf32df96 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -448,13 +448,17 @@ 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; - foreach ($aResults as $oRes) { - $oRes->iResultRank++; + if (!empty($aHnResults)) { + foreach ($aHnResults as $oRes) { + $aResults[$oRes->iId] = $oRes; } } } -- 2.39.5