]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
allow reverse search order by default
[nominatim.git] / lib / Geocode.php
index 0e4bd0a0ab60dbe1ec2f03d7a732b1db1923b2fa..e1acb2f646c1ed69ef7cc9a41e34b6b54e735e9e 100644 (file)
@@ -15,7 +15,7 @@
 
                protected $aExcludePlaceIDs = array();
                protected $bDeDupe = true;
-               protected $bReverseInPlan = false;
+               protected $bReverseInPlan = true;
 
                protected $iLimit = 20;
                protected $iFinalLimit = 10;
                                // Commas are used to reduce the search space by indicating where phrases split
                                if ($this->aStructuredQuery)
                                {
-                                       $aPhrases = $aStructuredQuery;
+                                       $aPhrases = $this->aStructuredQuery;
                                        $bStructuredPhrases = true;
                                }
                                else
                                                $sSQL = "select place_id from placex where place_id in (".join(',',$aResultPlaceIDs).") ";
                                                $sSQL .= "and (placex.rank_address between $this->iMinAddressRank and $this->iMaxAddressRank ";
                                                if (14 >= $this->iMinAddressRank && 14 <= $this->iMaxAddressRank) $sSQL .= " OR (extratags->'place') = 'city'";
-                                               if ($aAddressRankList) $sSQL .= " OR placex.rank_address in (".join(',',$aAddressRankList).")";
+                                               if ($this->aAddressRankList) $sSQL .= " OR placex.rank_address in (".join(',',$this->aAddressRankList).")";
                                                $sSQL .= ") UNION select place_id from location_property_tiger where place_id in (".join(',',$aResultPlaceIDs).") ";
                                                $sSQL .= "and (30 between $this->iMinAddressRank and $this->iMaxAddressRank ";
-                                               if ($aAddressRankList) $sSQL .= " OR 30 in (".join(',',$aAddressRankList).")";
+                                               if ($this->aAddressRankList) $sSQL .= " OR 30 in (".join(',',$this->aAddressRankList).")";
                                                $sSQL .= ")";
                                                if (CONST_Debug) var_dump($sSQL);
                                                $aResultPlaceIDs = $this->oDB->getCol($sSQL);
                                        $aResult['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$aClassType[$aResult['class'].':'.$aResult['type']]['icon'].'.p.20.png';
                                }
 
-                               if (isset($aClassType[$aResult['class'].':'.$aResult['type']]['label'])
+                               if (isset($aClassType[$aResult['class'].':'.$aResult['type'].':'.$aResult['admin_level']]['label'])
+                                               && $aClassType[$aResult['class'].':'.$aResult['type'].':'.$aResult['admin_level']]['label'])
+                               {
+                                       $aResult['label'] = $aClassType[$aResult['class'].':'.$aResult['type'].':'.$aResult['admin_level']]['label'];
+                               }
+                               elseif (isset($aClassType[$aResult['class'].':'.$aResult['type']]['label'])
                                                && $aClassType[$aResult['class'].':'.$aResult['type']]['label'])
                                {
                                        $aResult['label'] = $aClassType[$aResult['class'].':'.$aResult['type']]['label'];