- // If the token is valid
- if (isset($aValidTokens[' '.$sToken])) {
- foreach ($aValidTokens[' '.$sToken] as $aSearchTerm) {
- $aNewSearches = $oCurrentSearch->extendWithFullTerm(
- $aSearchTerm,
- isset($aValidTokens[$sToken])
- && strpos($sToken, ' ') === false,
- $sPhraseType,
- $iToken == 0 && $iPhrase == 0,
- $iPhrase == 0,
- $iToken + 1 == count($aWordset)
- && $iPhrase + 1 == count($aPhrases)
- );
-
- foreach ($aNewSearches as $oSearch) {
- if ($oSearch->getRank() < $this->iMaxRank) {
- $aNewWordsetSearches[] = $oSearch;
- }
+ // Tokens with full name matches.
+ foreach ($oValidTokens->get(' '.$sToken) as $oSearchTerm) {
+ $aNewSearches = $oCurrentSearch->extendWithFullTerm(
+ $oSearchTerm,
+ $oValidTokens->contains($sToken)
+ && strpos($sToken, ' ') === false,
+ $sPhraseType,
+ $iToken == 0 && $iPhrase == 0,
+ $iPhrase == 0,
+ $iToken + 1 == count($aWordset)
+ && $iPhrase + 1 == count($aPhrases)
+ );
+
+ foreach ($aNewSearches as $oSearch) {
+ if ($oSearch->getRank() < $this->iMaxRank) {
+ $aNewWordsetSearches[] = $oSearch;