]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow sorting by housenumbers for rare street names
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 29 Mar 2021 10:06:51 +0000 (12:06 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 29 Mar 2021 10:06:51 +0000 (12:06 +0200)
Usually we don't narrow down search results by house number when
only a street name is given because there may be a lot of rows
to cross check when the street name is very frequent. However,
when it is known to be rare, the housenumber check may be done
anyway.

Fixes #2238.

lib-php/SearchDescription.php

index 228b099917d6377f102a2987bf9e6f76af68058b..2b39443f6e79f1b86b1571520ac0c1d4369cf6bc 100644 (file)
@@ -614,7 +614,7 @@ class SearchDescription
         // 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)) {
+        if ($this->sHouseNumber && ($this->bRareName || !empty($this->aAddress) || $this->sPostcode)) {
             $sHouseNumberRegex = '\\\\m'.$this->sHouseNumber.'\\\\M';
             $aOrder[] = ' (';
             $aOrder[0] .= 'EXISTS(';