本文整理汇总了PHP中ArticleSearchIndex::rebuildIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::rebuildIndex方法的具体用法?PHP ArticleSearchIndex::rebuildIndex怎么用?PHP ArticleSearchIndex::rebuildIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::rebuildIndex方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rebuildSearchIndex
/**
* Rebuild the search index.
* @return boolean
*/
function rebuildSearchIndex()
{
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->rebuildIndex();
return true;
}
示例2: execute
/**
* Rebuild the search index for all articles in all journals.
*/
function execute()
{
// If we have an argument that this must be a journal path.
$journal = null;
if (count($this->argv)) {
$journalPath = array_shift($this->argv);
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journal =& $journalDao->getJournalByPath($journalPath);
if (!$journal) {
die(__('search.cli.rebuildIndex.unknownJournal', array('journalPath' => $journalPath)) . "\n");
}
}
// Register a router hook so that we can construct
// useful URLs to journal content.
HookRegistry::register('Request::getBaseUrl', array(&$this, 'callbackBaseUrl'));
// Let the search implementation re-build the index.
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->rebuildIndex(true, $journal);
}
示例3: execute
/**
* Rebuild the search index for all articles in all journals.
*/
function execute()
{
// Check whether we have (optional) switches.
$switches = array();
while (count($this->argv) && substr($this->argv[0], 0, 1) == '-') {
$switches[] = array_shift($this->argv);
}
// If we have another argument that this must be a journal path.
$journal = null;
if (count($this->argv)) {
$journalPath = array_shift($this->argv);
$journalDao = DAORegistry::getDAO('JournalDAO');
$journal = $journalDao->getByPath($journalPath);
if (!$journal) {
die(__('search.cli.rebuildIndex.unknownJournal', array('journalPath' => $journalPath)) . "\n");
}
}
// Register a router hook so that we can construct
// useful URLs to journal content.
HookRegistry::register('Request::getBaseUrl', array($this, 'callbackBaseUrl'));
// Let the search implementation re-build the index.
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->rebuildIndex(true, $journal, $switches);
}
示例4: execute
/**
* Rebuild the search index for all articles in all journals.
*/
function execute()
{
ArticleSearchIndex::rebuildIndex(true);
}
示例5: rebuildSearchIndex
/**
* Rebuild the article search index.
* Note: Rebuilds index for _all_ journals (non-optimal, but shouldn't be a problem)
* Based on code from tools/rebuildSearchIndex.php
*/
function rebuildSearchIndex()
{
if ($this->hasOption('verbose')) {
printf("Rebuilding search index\n");
}
ArticleSearchIndex::rebuildIndex();
}
示例6: rebuildSearchIndex
/**
* Rebuild the search index.
* @return boolean
*/
function rebuildSearchIndex()
{
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::rebuildIndex();
return true;
}
示例7: testRebuildIndexViaPluginHook
/**
* @covers ArticleSearchIndex
*/
public function testRebuildIndexViaPluginHook()
{
// Diverting to the search plugin hook.
HookRegistry::register('ArticleSearchIndex::rebuildIndex', array($this, 'callbackRebuildIndex'));
// Test log output.
$this->expectOutputString("Some log message from the plug-in.");
// Simulate rebuilding the index via hook.
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->rebuildIndex(true);
// With log
$articleSearchIndex->rebuildIndex(false);
// Without log (that's why we expect the log message to appear only once).
// Remove the test hook.
HookRegistry::clear('ArticleSearchIndex::rebuildIndex');
}