當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArticleSearch::_getMergedPhraseResults方法代碼示例

本文整理匯總了PHP中ArticleSearch::_getMergedPhraseResults方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleSearch::_getMergedPhraseResults方法的具體用法?PHP ArticleSearch::_getMergedPhraseResults怎麽用?PHP ArticleSearch::_getMergedPhraseResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArticleSearch的用法示例。


在下文中一共展示了ArticleSearch::_getMergedPhraseResults方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

 /**
  * Recursive helper for _getMergedArray.
  */
 function &_getMergedKeywordResults(&$journal, &$keyword, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours)
 {
     $mergedResults = null;
     if (isset($keyword['type'])) {
         $type = $keyword['type'];
     }
     foreach ($keyword['+'] as $phrase) {
         $results =& ArticleSearch::_getMergedPhraseResults($journal, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
         if ($mergedResults == null) {
             $mergedResults = $results;
         } else {
             foreach ($mergedResults as $articleId => $count) {
                 if (isset($results[$articleId])) {
                     $mergedResults[$articleId] += $results[$articleId];
                 } else {
                     unset($mergedResults[$articleId]);
                 }
             }
         }
     }
     if ($mergedResults == null) {
         $mergedResults = array();
     }
     if (!empty($mergedResults) || empty($keyword['+'])) {
         foreach ($keyword[''] as $phrase) {
             $results =& ArticleSearch::_getMergedPhraseResults($journal, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
             foreach ($results as $articleId => $count) {
                 if (isset($mergedResults[$articleId])) {
                     $mergedResults[$articleId] += $count;
                 } else {
                     if (empty($keyword['+'])) {
                         $mergedResults[$articleId] = $count;
                     }
                 }
             }
         }
         foreach ($keyword['-'] as $phrase) {
             $results =& ArticleSearch::_getMergedPhraseResults($journal, $phrase, $type, $publishedFrom, $publishedTo, $resultsPerKeyword, $resultCacheHours);
             foreach ($results as $articleId => $count) {
                 if (isset($mergedResults[$articleId])) {
                     unset($mergedResults[$articleId]);
                 }
             }
         }
     }
     return $mergedResults;
 }
開發者ID:alenoosh,項目名稱:ojs,代碼行數:50,代碼來源:ArticleSearch.inc.php


注:本文中的ArticleSearch::_getMergedPhraseResults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。