]> git.openstreetmap.org Git - nominatim.git/blobdiff - website/search.php
remove the structuredAddressElement function from search that was moved to lib.php
[nominatim.git] / website / search.php
index 3655b5c3408a22ee2c68eec4cf274cc94e2e44ef..3eb50aa20bc1e4b3aceb7dce96bb4fcf3d32ea9f 100755 (executable)
@@ -17,7 +17,6 @@
        $aSearchResults = array();
        $aExcludePlaceIDs = array();
        $sCountryCodesSQL = false;
        $aSearchResults = array();
        $aExcludePlaceIDs = array();
        $sCountryCodesSQL = false;
-       $sSuggestion = $sSuggestionURL = false;
        $bDeDupe = isset($_GET['dedupe'])?(bool)$_GET['dedupe']:true;
        $bReverseInPlan = false;
        $iFinalLimit = isset($_GET['limit'])?(int)$_GET['limit']:10;
        $bDeDupe = isset($_GET['dedupe'])?(bool)$_GET['dedupe']:true;
        $bReverseInPlan = false;
        $iFinalLimit = isset($_GET['limit'])?(int)$_GET['limit']:10;
                $sQuery = join(', ',$aPhrases);
        }
 
                $sQuery = join(', ',$aPhrases);
        }
 
-       function structuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, $aParams, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank)
-       {
-               if (!isset($_GET[$sKey])) return false;
-               $sValue = trim($_GET[$sKey]);
-               if (!$sValue) return false;
-               $aStructuredQuery[$sKey] = $sValue;
-               if ($iMinAddressRank == 0 && $iMaxAddressRank == 30)
-               {
-                       $iMinAddressRank = $iNewMinAddressRank;
-                       $iMaxAddressRank = $iNewMaxAddressRank;
-               }
-               return true;
-       }
-
        // Structured query?
        $aStructuredOptions = array(
                                array('amenity', 26, 30),
        // Structured query?
        $aStructuredOptions = array(
                                array('amenity', 26, 30),
                        $sNearPointSQL = false;
                        if (isset($_GET['nearlat']) && isset($_GET['nearlon']))
                        {
                        $sNearPointSQL = false;
                        if (isset($_GET['nearlat']) && isset($_GET['nearlon']))
                        {
-                               $sNearPointSQL = "ST_SetSRID(ST_Point(".(float)$_GET['nearlon'].",".$_GET['nearlat']."),4326)";
+                               $sNearPointSQL = "ST_SetSRID(ST_Point(".(float)$_GET['nearlon'].",".(float)$_GET['nearlat']."),4326)";
                                $aSearches[0]['fLat'] = (float)$_GET['nearlat'];
                                $aSearches[0]['fLon'] = (float)$_GET['nearlon'];
                                $aSearches[0]['fRadius'] = 0.1;
                                $aSearches[0]['fLat'] = (float)$_GET['nearlat'];
                                $aSearches[0]['fLon'] = (float)$_GET['nearlon'];
                                $aSearches[0]['fRadius'] = 0.1;
                                }
                                if (CONST_Debug) var_Dump($aPhrases, $aValidTokens);
 
                                }
                                if (CONST_Debug) var_Dump($aPhrases, $aValidTokens);
 
-                               $aSuggestion = array();
-                               $bSuggestion = false;
-                               if (CONST_Suggestions_Enabled)
-                               {
-                                       foreach($aPhrases as $iPhrase => $aPhrase)
-                                       {
-                                               if (!isset($aValidTokens[' '.$aPhrase['wordsets'][0][0]]))
-                                               {
-                                                       $sQuotedPhrase = getDBQuoted(' '.$aPhrase['wordsets'][0][0]);
-                                                       $aSuggestionWords = getWordSuggestions($oDB, $aPhrase['wordsets'][0][0]);
-                                                       $aRow = $aSuggestionWords[0];
-                                                       if ($aRow && $aRow['word'])
-                                                       {
-                                                               $aSuggestion[] = $aRow['word'];
-                                                               $bSuggestion = true;
-                                                       }
-                                                       else
-                                                       {
-                                                               $aSuggestion[] = $aPhrase['string'];
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       $aSuggestion[] = $aPhrase['string'];
-                                               }
-                                       }
-                               }
-                               if ($bSuggestion) $sSuggestion = join(', ',$aSuggestion);
-
                                // Try and calculate GB postcodes we might be missing
                                foreach($aTokens as $sToken)
                                {
                                // Try and calculate GB postcodes we might be missing
                                foreach($aTokens as $sToken)
                                {
                {
                        if (isset($_GET['nearlat']) && trim($_GET['nearlat'])!=='' && isset($_GET['nearlon']) && trim($_GET['nearlon']) !== '')
                        {
                {
                        if (isset($_GET['nearlat']) && trim($_GET['nearlat'])!=='' && isset($_GET['nearlon']) && trim($_GET['nearlon']) !== '')
                        {
-                               $iPlaceID = geocodeReverse($_GET['nearlat'], $_GET['nearlon']);
+                               $iPlaceID = geocodeReverse((float)$_GET['nearlat'], (float)$_GET['nearlon']);
 
                                if ($iPlaceID)
                                {
 
                                if ($iPlaceID)
                                {
        if ($bShowAddressDetails) $sMoreURL .= '&addressdetails=1';
        if (isset($_GET['viewbox']) && $_GET['viewbox']) $sMoreURL .= '&viewbox='.urlencode($_GET['viewbox']);
        if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
        if ($bShowAddressDetails) $sMoreURL .= '&addressdetails=1';
        if (isset($_GET['viewbox']) && $_GET['viewbox']) $sMoreURL .= '&viewbox='.urlencode($_GET['viewbox']);
        if (isset($_GET['nearlat']) && isset($_GET['nearlon'])) $sMoreURL .= '&nearlat='.(float)$_GET['nearlat'].'&nearlon='.(float)$_GET['nearlon'];
-       if ($sSuggestion)
-       {
-               $sSuggestionURL = $sMoreURL.'&q='.urlencode($sSuggestion);
-       }
        $sMoreURL .= '&q='.urlencode($sQuery);
 
        if (CONST_Debug) exit;
        $sMoreURL .= '&q='.urlencode($sQuery);
 
        if (CONST_Debug) exit;