- $aSearch['aAddress'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
- if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
+ if ($aWordFrequencyScores[$aSearchTerm['word_id']] < CONST_Max_Word_Frequency)
+ {
+ $aSearch['aAddress'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
+ if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
+ }
+ elseif (isset($aValidTokens[' '.$sToken])) // revert to the token version?
+ {
+ foreach($aValidTokens[' '.$sToken] as $aSearchTermToken)
+ {
+ if (empty($aSearchTermToken['country_code'])
+ && empty($aSearchTermToken['lat'])
+ && empty($aSearchTermToken['class']))
+ {
+ $aSearch = $aCurrentSearch;
+ $aSearch['iSearchRank'] += 1;
+ $aSearch['aAddress'][$aSearchTermToken['word_id']] = $aSearchTermToken['word_id'];
+ if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
+ }
+ }
+ }
+ else
+ {
+ $aSearch['aAddressNonSearch'][$aSearchTerm['word_id']] = $aSearchTerm['word_id'];
+ if ($aSearch['iSearchRank'] < $iMaxRank) $aNewWordsetSearches[] = $aSearch;
+ }