mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-09-11 19:17:17 +03:00
fix structured and batch mode. Add constant to disable batch mode by default
This commit is contained in:
parent
27e6a24718
commit
a974d25092
@ -190,6 +190,20 @@
|
||||
return $this->sQuery;
|
||||
}
|
||||
|
||||
function loadStructuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, &$aAddressRankList, $sValue, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank, $aItemListValues)
|
||||
{
|
||||
$sValue = trim($sValue);
|
||||
if (!$sValue) return false;
|
||||
$aStructuredQuery[$sKey] = $sValue;
|
||||
if ($iMinAddressRank == 0 && $iMaxAddressRank == 30)
|
||||
{
|
||||
$iMinAddressRank = $iNewMinAddressRank;
|
||||
$iMaxAddressRank = $iNewMaxAddressRank;
|
||||
}
|
||||
if ($aItemListValues) $aAddressRankList = array_merge($aAddressRankList, $aItemListValues);
|
||||
return true;
|
||||
}
|
||||
|
||||
function setStructuredQuery($sAmentiy = false, $sStreet = false, $sCity = false, $sCounty = false, $sState = false, $sCountry = false, $sPostalCode = false)
|
||||
{
|
||||
$this->sQuery = false;
|
||||
@ -197,13 +211,13 @@
|
||||
$this->aStructuredQuery = array();
|
||||
$this->sAllowedTypesSQLList = '';
|
||||
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sAmentiy, 'amenity', 26, 30, false);
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sStreet, 'street', 26, 30, false);
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCity, 'city', 14, 24, false);
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCounty, 'county', 9, 13, false);
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sState, 'state', 8, 8, false);
|
||||
loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sCountry, 'country', 4, 4, false);
|
||||
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, $sAmentiy, 'amenity', 26, 30, false);
|
||||
$this->loadStructuredAddressElement($this->aStructuredQuery, $this->iMinAddressRank, $this->iMaxAddressRank, $this->aAddressRankList, $sStreet, 'street', 26, 30, false);
|
||||
$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));
|
||||
|
||||
if (sizeof($this->aStructuredQuery) > 0)
|
||||
{
|
||||
|
15
lib/lib.php
15
lib/lib.php
@ -884,21 +884,6 @@
|
||||
return $iPlaceID;
|
||||
}
|
||||
|
||||
function loadStructuredAddressElement(&$aStructuredQuery, &$iMinAddressRank, &$iMaxAddressRank, &$aAddressRankList, $aParams, $sKey, $iNewMinAddressRank, $iNewMaxAddressRank, $aItemListValues)
|
||||
{
|
||||
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;
|
||||
}
|
||||
if ($aItemListValues) $aAddressRankList = array_merge($aAddressRankList, $aItemListValues);
|
||||
return true;
|
||||
}
|
||||
|
||||
function addQuotes($s)
|
||||
{
|
||||
return "'".$s."'";
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
foreach($aBatchResults as $aSearchResults)
|
||||
{
|
||||
if (!$aSearchResults) $aSearchResults = array();
|
||||
$aFilteredPlaces = array();
|
||||
foreach($aSearchResults as $iResNum => $aPointDetails)
|
||||
{
|
||||
|
@ -67,6 +67,8 @@
|
||||
@define('CONST_Search_AreaPolygons_Enabled', true);
|
||||
@define('CONST_Search_AreaPolygons', true);
|
||||
|
||||
@define('CONST_Search_BatchMode', false);
|
||||
|
||||
@define('CONST_Search_TryDroppedAddressTerms', false);
|
||||
@define('CONST_Search_NameOnlySearchFrequencyThreshold', false);
|
||||
|
||||
|
@ -160,7 +160,7 @@
|
||||
|
||||
loadParamsToGeocode($oGeocode, $_GET, false);
|
||||
|
||||
if (isset($_GET['batch']))
|
||||
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
||||
{
|
||||
$aBatch = json_decode($_GET['batch'], true);
|
||||
$aBatchResults = array();
|
||||
|
Loading…
Reference in New Issue
Block a user