No need to hand them in separately.
return $aSearchResults;
}
return $aSearchResults;
}
- public function getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bIsStructured, $sNormQuery)
+ public function getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $bIsStructured, $sNormQuery)
{
/*
Calculate all searches using aValidTokens i.e.
{
/*
Calculate all searches using aValidTokens i.e.
$aSearchTerm,
$bIsStructured,
$iPhrase,
$aSearchTerm,
$bIsStructured,
$iPhrase,
isset($aValidTokens[' '.$sToken]) ? $aValidTokens[' '.$sToken] : array()
);
isset($aValidTokens[' '.$sToken]) ? $aValidTokens[' '.$sToken] : array()
);
// Any words that have failed completely?
// TODO: suggestions
// Any words that have failed completely?
// TODO: suggestions
- $aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, $bStructuredPhrases, $sNormQuery);
+ $aGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $bStructuredPhrases, $sNormQuery);
if ($this->bReverseInPlan) {
// Reverse phrase array and also reverse the order of the wordsets in
if ($this->bReverseInPlan) {
// Reverse phrase array and also reverse the order of the wordsets in
if (sizeof($aPhrases) > 1) {
$aPhrases[sizeof($aPhrases)-1]->invertWordSets();
}
if (sizeof($aPhrases) > 1) {
$aPhrases[sizeof($aPhrases)-1]->invertWordSets();
}
- $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, $aWordFrequencyScores, false, $sNormQuery);
+ $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $aValidTokens, false, $sNormQuery);
foreach ($aGroupedSearches as $aSearches) {
foreach ($aSearches as $aSearch) {
foreach ($aGroupedSearches as $aSearches) {
foreach ($aSearches as $aSearch) {
* @param mixed[] $aSearchTerm Description of the token.
* @param bool $bStructuredPhrases True if the search is structured.
* @param integer $iPhrase Number of the phrase the token is in.
* @param mixed[] $aSearchTerm Description of the token.
* @param bool $bStructuredPhrases True if the search is structured.
* @param integer $iPhrase Number of the phrase the token is in.
- * @param mixed[] $aWordFrequencyScores Number of times tokens appears
- * overall in a planet database.
* @param array[] $aFullTokens List of full term tokens with the
* same name.
*
* @return SearchDescription[] List of derived search descriptions.
*/
* @param array[] $aFullTokens List of full term tokens with the
* same name.
*
* @return SearchDescription[] List of derived search descriptions.
*/
- public function extendWithPartialTerm($aSearchTerm, $bStructuredPhrases, $iPhrase, &$aWordFrequencyScores, $aFullTokens)
+ public function extendWithPartialTerm($aSearchTerm, $bStructuredPhrases, $iPhrase, $aFullTokens)
{
// Only allow name terms.
if (!(isset($aSearchTerm['word_id']) && $aSearchTerm['word_id'])) {
{
// Only allow name terms.
if (!(isset($aSearchTerm['word_id']) && $aSearchTerm['word_id'])) {
&& sizeof($this->aName)
&& strpos($aSearchTerm['word_token'], ' ') === false
) {
&& sizeof($this->aName)
&& strpos($aSearchTerm['word_token'], ' ') === false
) {
- if ($aWordFrequencyScores[$iWordID] < CONST_Max_Word_Frequency) {
+ if ($aSearchTerm['search_name_count'] + 1 < CONST_Max_Word_Frequency) {
$oSearch = clone $this;
$oSearch->iSearchRank++;
$oSearch->aAddress[$iWordID] = $iWordID;
$oSearch = clone $this;
$oSearch->iSearchRank++;
$oSearch->aAddress[$iWordID] = $iWordID;
if (preg_match('#^[0-9]+$#', $aSearchTerm['word_token'])) {
$oSearch->iSearchRank += 2;
}
if (preg_match('#^[0-9]+$#', $aSearchTerm['word_token'])) {
$oSearch->iSearchRank += 2;
}
- if ($aWordFrequencyScores[$iWordID] < CONST_Max_Word_Frequency) {
+ if ($aSearchTerm['search_name_count'] + 1 < CONST_Max_Word_Frequency) {
$oSearch->aName[$iWordID] = $iWordID;
} else {
$oSearch->aNameNonSearch[$iWordID] = $iWordID;
$oSearch->aName[$iWordID] = $iWordID;
} else {
$oSearch->aNameNonSearch[$iWordID] = $iWordID;