]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
more partitioning work, os open data postcodes, country list fixes
[nominatim.git] / website / search.php
index a123e833a0e7ee66e9dbfec0f551a8d78ae7d847..a1052394410b5dc5e4dc40d1a3f900175c3ad029 100755 (executable)
                                                                                }
                                                                                else
                                                                                {
-                                                                                       $aSearch['aAddress'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
-                                                                                       if (!sizeof($aSearch['aName']))
+                                                                                       if (sizeof($aSearch['aName']))
+                                                                                       {
+                                                                                               $aSearch['aAddress'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
+                                                                                       }
+                                                                                       else
                                                                                        {
                                                                                                $aSearch['aName'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
                                                                                                $aSearch['iNamePhrase'] = $iPhrase;
                                        {
                                                $iQueryLoop++;
                                                // Must have a location term
-                                               if (!sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress']))
+                                               if (!sizeof($aSearch['aName']) && !sizeof($aSearch['aAddress'] && !$aSearch['fLon']))
                                                {
                                                        if (!$bBoundingBoxSearch && !$aSearch['fLon']) continue;
                                                        if (!$aSearch['sClass']) continue;
                                                                $oDB->query($sSQL);
                                                        
                                                                // Now they are indexed look for a house attached to a street we found
-                                                               $sSQL = "select place_id from placex where street_place_id in (".$sPlaceIDs.") and housenumber ~* E'".$sHouseNumberRegex."'";
+                                                               $sSQL = "select place_id from placex where parent_place_id in (".$sPlaceIDs.") and housenumber ~* E'".$sHouseNumberRegex."'";
                                                                if (sizeof($aExcludePlaceIDs))
                                                                {
                                                                        $sSQL .= " and place_id not in (".join(',',$aExcludePlaceIDs).")";