MDL-53325 search: Optimize Solr less often

This commit is contained in:
Eric Merrill
2016-03-06 13:46:54 -05:00
parent 7adc7ef14f
commit bf2235bb11
8 changed files with 96 additions and 12 deletions
+6 -4
View File
@@ -474,7 +474,7 @@ class manager {
// Unlimited time.
\core_php_time_limit::raise();
$anyupdate = false;
$sumdocs = 0;
$searchareas = $this->get_search_areas_list(true);
foreach ($searchareas as $areaid => $searcharea) {
@@ -527,7 +527,7 @@ class manager {
}
if ($numdocs > 0) {
$anyupdate = true;
$sumdocs += $numdocs;
// Commit all remaining documents.
$this->engine->commit();
@@ -551,13 +551,15 @@ class manager {
}
}
if ($anyupdate) {
if ($sumdocs > 0) {
$event = \core\event\search_indexed::create(
array('context' => \context_system::instance()));
$event->trigger();
}
return $anyupdate;
$this->engine->index_complete($sumdocs, $fullindex);
return (bool)$sumdocs;
}
/**