return $aSearchResults;
}
- function getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases)
+ function getGroupedSearches($aSearches, $aPhraseTypes, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases)
{
/*
Calculate all searches using aValidTokens i.e.
}
}
}
- if (isset($aValidTokens[$sToken]))
+ // Look for partial matches.
+ // Note that there is no point in adding country terms here
+ // because country are omitted in the address.
+ if (isset($aValidTokens[$sToken]) && $sPhraseType != 'country')
{
// Allow searching for a word - but at extra cost
foreach($aValidTokens[$sToken] as $aSearchTerm)
// Start the search process
$aResultPlaceIDs = array();
- $aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases);
+ $aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhraseTypes, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases);
if ($this->bReverseInPlan)
{
$aFinalPhrase = end($aPhrases);
$aFinalPhrase['wordsets'] = getInverseWordSets($aFinalPhrase['words'], 0);
}
- $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, false);
+ $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, null, $aPhrases, $aValidTokens, $aWordFrequencyScores, false);
foreach($aGroupedSearches as $aSearches)
{
$sSQL = "select place_id from placex where calculated_country_code='".$aSearch['sCountryCode']."' and rank_search = 4";
if ($sCountryCodesSQL) $sSQL .= " and calculated_country_code in ($sCountryCodesSQL)";
if ($bBoundingBoxSearch)
- $sSQL .= " and st_overlaps($this->sViewboxSmallSQL, geometry)";
+ $sSQL .= " and _st_intersects($this->sViewboxSmallSQL, geometry)";
$sSQL .= " order by st_area(geometry) desc limit 1";
if (CONST_Debug) var_dump($sSQL);
$aPlaceIDs = $this->oDB->getCol($sSQL);
$bFirst = true;
foreach($aToFilter as $iResNum => $aResult)
{
- if ($aResult['type'] == 'adminitrative') $aResult['type'] = 'administrative';
$this->aExcludePlaceIDs[$aResult['place_id']] = $aResult['place_id'];
if ($bFirst)
{