X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/fd38dd02ce0d503ff520a08ea98b7b11ab8988d3..f3c557bf684a0079e4bc54b622cc5d766f3a6b56:/lib-php/SearchDescription.php diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index fbf6b650..b98c2e72 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -264,6 +264,8 @@ class SearchDescription { if (empty($this->aName)) { $this->bNameNeedsAddress = $bNeedsAddress; + } elseif ($bSearchable && count($this->aName) >= 2) { + $this->bNameNeedsAddress = false; } else { $this->bNameNeedsAddress &= $bNeedsAddress; } @@ -642,6 +644,7 @@ class SearchDescription // Housenumbers on streets and places. $sPlacexSql = 'SELECT array_agg(place_id) FROM placex'; $sPlacexSql .= ' WHERE parent_place_id = sin.place_id AND sin.address_rank < 30'; + $sPlacexSql .= $this->oContext->excludeSQL(' AND place_id'); $sPlacexSql .= ' and housenumber ~* E'.$sHouseNumberRegex; // Interpolations on streets and places. @@ -804,6 +807,7 @@ class SearchDescription $sSQL = 'SELECT geometry FROM placex'; $sSQL .= " WHERE place_id in ($sPlaceIDs)"; $sSQL .= " AND rank_search < $iMaxRank + 5"; + $sSQL .= ' AND ST_Area(Box2d(geometry)) < 20'; $sSQL .= " AND ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon')"; $sSQL .= ' ORDER BY rank_search ASC '; $sSQL .= ' LIMIT 1';