示例#1
0
 /**
  * Recursive helper for _getMergedArray.
  */
 function &_getMergedKeywordResults(&$conference, &$keyword, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours)
 {
     $mergedResults = null;
     if (isset($keyword['type'])) {
         $type = $keyword['type'];
     }
     foreach ($keyword['+'] as $phrase) {
         $results =& PaperSearch::_getMergedPhraseResults($conference, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
         if ($mergedResults == null) {
             $mergedResults = $results;
         } else {
             foreach ($mergedResults as $paperId => $count) {
                 if (isset($results[$paperId])) {
                     $mergedResults[$paperId] += $results[$paperId];
                 } else {
                     unset($mergedResults[$paperId]);
                 }
             }
         }
     }
     if ($mergedResults == null) {
         $mergedResults = array();
     }
     if (!empty($mergedResults) || empty($keyword['+'])) {
         foreach ($keyword[''] as $phrase) {
             $results =& PaperSearch::_getMergedPhraseResults($conference, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
             foreach ($results as $paperId => $count) {
                 if (isset($mergedResults[$paperId])) {
                     $mergedResults[$paperId] += $count;
                 } else {
                     if (empty($keyword['+'])) {
                         $mergedResults[$paperId] = $count;
                     }
                 }
             }
         }
         foreach ($keyword['-'] as $phrase) {
             $results =& PaperSearch::_getMergedPhraseResults($conference, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
             foreach ($results as $paperId => $count) {
                 if (isset($mergedResults[$paperId])) {
                     unset($mergedResults[$paperId]);
                 }
             }
         }
     }
     return $mergedResults;
 }