本文整理匯總了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;
}