$aViewbox = $oParams->getStringList('viewboxlbrt');
if ($aViewbox) {
if (count($aViewbox) != 4) {
- userError("Bad parmater 'viewboxlbrt'. Expected 4 coordinates.");
+ userError("Bad parameter 'viewboxlbrt'. Expected 4 coordinates.");
}
$this->setViewbox($aViewbox);
} else {
$aViewbox = $oParams->getStringList('viewbox');
if ($aViewbox) {
if (count($aViewbox) != 4) {
- userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
+ userError("Bad parameter 'viewbox'. Expected 4 coordinates.");
}
$this->setViewBox($aViewbox);
} else {
$this->loadStructuredAddressElement($sPostalCode, 'postalcode', 5, 11, array(5, 11));
$this->loadStructuredAddressElement($sCountry, 'country', 4, 4, false);
- if (sizeof($this->aStructuredQuery) > 0) {
+ if (!empty($this->aStructuredQuery)) {
$this->sQuery = join(', ', $this->aStructuredQuery);
if ($this->iMaxAddressRank < 30) {
$this->sAllowedTypesSQLList = '(\'place\',\'boundary\')';
$aParams = $this->aStructuredQuery;
- if (sizeof($aParams) == 1) return false;
+ if (count($aParams) == 1) return false;
$aOrderToFallback = array('postalcode', 'street', 'city', 'county', 'state');
$sPhraseType,
$iToken == 0 && $iPhrase == 0,
$iPhrase == 0,
- $iToken + 1 == sizeof($aWordset)
- && $iPhrase + 1 == sizeof($aPhrases)
+ $iToken + 1 == count($aWordset)
+ && $iPhrase + 1 == count($aPhrases)
);
foreach ($aNewSearches as $oSearch) {
usort($aNewWordsetSearches, array('Nominatim\SearchDescription', 'bySearchRank'));
$aWordsetSearches = array_slice($aNewWordsetSearches, 0, 50);
}
- //var_Dump('<hr>',sizeof($aWordsetSearches)); exit;
+ //var_Dump('<hr>',count($aWordsetSearches)); exit;
$aNewPhraseSearches = array_merge($aNewPhraseSearches, $aNewWordsetSearches);
usort($aNewPhraseSearches, array('Nominatim\SearchDescription', 'bySearchRank'));
$iSearchCount = 0;
$aSearches = array();
foreach ($aGroupedSearches as $iScore => $aNewSearches) {
- $iSearchCount += sizeof($aNewSearches);
+ $iSearchCount += count($aNewSearches);
$aSearches = array_merge($aSearches, $aNewSearches);
if ($iSearchCount > 50) break;
}
}
}
- if (sizeof($aTokens)) {
+ if (!empty($aTokens)) {
// Check which tokens we have, get the ID numbers
$sSQL = 'SELECT word_id, word_token, word, class, type, country_code, operator, search_name_count';
$sSQL .= ' FROM word ';
// because order in the address doesn't matter.
$aPhrases = array_reverse($aPhrases);
$aPhrases[0]->invertWordSets();
- if (sizeof($aPhrases) > 1) {
- $aPhrases[sizeof($aPhrases)-1]->invertWordSets();
+ if (count($aPhrases) > 1) {
+ $aPhrases[count($aPhrases)-1]->invertWordSets();
}
$aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, false);
$sHash = serialize($aSearch);
if (isset($aSearchHash[$sHash])) {
unset($aGroupedSearches[$iGroup][$iSearch]);
- if (sizeof($aGroupedSearches[$iGroup]) == 0) unset($aGroupedSearches[$iGroup]);
+ if (empty($aGroupedSearches[$iGroup])) unset($aGroupedSearches[$iGroup]);
} else {
$aSearchHash[$sHash] = 1;
}
if ($iQueryLoop > 20) break;
}
- if (sizeof($aResults) && ($this->iMinAddressRank != 0 || $this->iMaxAddressRank != 30)) {
+ if (!empty($aResults) && ($this->iMinAddressRank != 0 || $this->iMaxAddressRank != 30)) {
// Need to verify passes rank limits before dropping out of the loop (yuk!)
// reduces the number of place ids, like a filter
// rank_address is 30 for interpolated housenumbers
$aResults = $tempIDs;
}
- if (sizeof($aResults)) break;
+ if (!empty($aResults)) break;
if ($iGroupLoop > 4) break;
if ($iQueryLoop > 30) break;
}
}
// No results? Done
- if (!sizeof($aResults)) {
+ if (empty($aResults)) {
if ($this->bFallback) {
if ($this->fallbackStructuredQuery()) {
return $this->lookup();
$aResult['importance'] = 0.001;
$aResult['foundorder'] = $aResult['addressimportance'];
} else {
- // Adjust importance for the number of exact string matches in the result
+ $aResult['importance'] = max(0.001, $aResult['importance']);
$aResult['importance'] *= $this->viewboxImportanceFactor(
$aResult['lon'],
$aResult['lat']
);
- $aResult['importance'] = max(0.001, $aResult['importance']);
+ // Adjust importance for the number of exact string matches in the result
$iCountWords = 0;
$sAddress = $aResult['langaddress'];
foreach ($aRecheckWords as $i => $sWord) {
}
// Absolute limit on number of results
- if (sizeof($aSearchResults) >= $this->iFinalLimit) break;
+ if (count($aSearchResults) >= $this->iFinalLimit) break;
}
if (CONST_Debug) var_dump($aSearchResults);