From c555b60b366d6efb9acada65e0212196837a8b0f Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 7 May 2018 21:28:32 +0200 Subject: [PATCH] narrow down search by house number when postcode is given Fixes #1034. --- lib/SearchDescription.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index 07eccec4..5f01e01b 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -593,7 +593,11 @@ class SearchDescription $aTerms = array(); $aOrder = array(); - if ($this->sHouseNumber && !empty($this->aAddress)) { + // Sort by existence of the requested house number but only if not + // too many results are expected for the street, i.e. if the result + // will be narrowed down by an address. Remeber that with ordering + // every single result has to be checked. + if ($this->sHouseNumber && (!empty($this->aAddress) || $this->sPostcode)) { $sHouseNumberRegex = '\\\\m'.$this->sHouseNumber.'\\\\M'; $aOrder[] = ' ('; $aOrder[0] .= 'EXISTS('; -- 2.39.5