X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/ea69733082106f4e8cc6077f744e5ce7ca256f2d..50352c634da0b44bd595a278406cd9654ce94d86:/lib-php/SearchDescription.php diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 65df58ef..5d2caf00 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -236,7 +236,7 @@ class SearchDescription * Add the given full-word token to the list of terms to search for in the * name. * - * @param interger iId ID of term to add. + * @param integer iId ID of term to add. * @param bool bRareName True if the term is infrequent enough to not * require other constraints for efficient search. */ @@ -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; } @@ -385,7 +387,7 @@ class SearchDescription * * @return mixed[] An array with two fields: IDs contains the list of * matching place IDs and houseNumber the houseNumber - * if appicable or -1 if not. + * if applicable or -1 if not. */ public function query(&$oDB, $iMinRank, $iMaxRank, $iLimit) { @@ -805,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';