Score how good the search is so they can be ordered
*/
- $iGlobalRank = 0;
-
foreach ($aPhrases as $iPhrase => $oPhrase) {
$aNewPhraseSearches = array();
$sPhraseType = $bIsStructured ? $oPhrase->getPhraseType() : '';
$iToken == 0 && $iPhrase == 0,
$iPhrase == 0,
$iToken + 1 == sizeof($aWordset)
- && $iPhrase + 1 == sizeof($aPhrases),
- $iGlobalRank
+ && $iPhrase + 1 == sizeof($aPhrases)
);
foreach ($aNewSearches as $oSearch) {
continue;
}
- $iRank = $oSearch->addToRank($iGlobalRank);
if (!isset($aGroupedSearches[$iRank])) {
$aGroupedSearches[$iRank] = array();
}
return $this->iSearchRank;
}
- /**
- * Increase the search rank.
- *
- * @param integer $iAddRank Number of ranks to increase.
- *
- * @return void
- */
- public function addToRank($iAddRank)
- {
- $this->iSearchRank += $iAddRank;
- return $this->iSearchRank;
- }
-
/**
* Make this search a POI search.
*
* @param bool $bFirstPhrase True if the token is in the first phrase of
* the query.
* @param bool $bLastToken True if the token is at the end of the query.
- * @param integer $iGlobalRank Changable ranking of all searches in the
- * batch.
*
* @return SearchDescription[] List of derived search descriptions.
*/
- public function extendWithFullTerm($aSearchTerm, $bHasPartial, $sPhraseType, $bFirstToken, $bFirstPhrase, $bLastToken, &$iGlobalRank)
+ public function extendWithFullTerm($aSearchTerm, $bHasPartial, $sPhraseType, $bFirstToken, $bFirstPhrase, $bLastToken)
{
$aNewSearches = array();
$oSearch->iSearchRank += 5;
}
$aNewSearches[] = $oSearch;
-
- // If it is at the beginning, we can be almost sure that
- // the terms are in the wrong order. Increase score for all searches.
- if ($bFirstToken) {
- $iGlobalRank++;
- }
}
} elseif (($sPhraseType == '' || $sPhraseType == 'postalcode')
&& $aSearchTerm['class'] == 'place' && $aSearchTerm['type'] == 'postcode'