]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/Geocode.php
move country to end of structured query
[nominatim.git] / lib / Geocode.php
index 3e5c7be1f2a72c2ba3988984e49cadb4fdad9b44..cadad11122d2c831c1fad9ca0fc4651c59ce2399 100644 (file)
                        $this->oDB =& $oDB;
                }
 
+               function setReverseInPlan($bReverse)
+               {
+                       $this->bReverseInPlan = $bReverse;
+               }
+
                function setLanguagePreference($aLangPref)
                {
                        $this->aLangPrefOrder = $aLangPref;
                        $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCity, 'city', 14, 24, false);
                        $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCounty, 'county', 9, 13, false);
                        $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sState, 'state', 8, 8, false);
-                       $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCountry, 'country', 4, 4, false);
                        $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sPostalCode, 'postalcode' , 5, 11, array(5, 11));
+                       $this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCountry, 'country', 4, 4, false);
 
                        if (sizeof($this->aStructuredQuery) > 0) 
                        {
                        $sSQL .= "from placex where place_id in ($sPlaceIDs) ";
                        $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 .= ") ";
                        if ($this->sAllowedTypesSQLList) $sSQL .= "and placex.class in $this->sAllowedTypesSQLList ";
                        $sSQL .= "and linked_place_id is null ";