Open cekowu opened 5 years ago
rebuild the index and try again to get bean, but it seem rebuild faild in ES, it leads this issue public function getHitsAsBeans() { $hits = $this->hits; $parsed = [];
foreach ($hits as $module => $beans) {
foreach ((array)$beans as $bean) {
$obj = BeanFactory::getBean($module, $bean);
// if a search found a bean but suitecrm does not, it could happens
// maybe the bean is deleted but elsasticsearch is not re-indexing yet.
// so at this point we trying to rebuild the index and try again to get bean:
if (!$obj) {
ElasticSearch\ElasticSearchIndexer::repairElasticsearchIndex();
$obj = BeanFactory::getBean($module, $bean);
}
if (!$obj) {
throw new Exception('Error retrieveing bean: ' . $module . ' [' . $bean . ']');
}
$obj->load_relationships();
$fieldDefs = $obj->getFieldDefinitions();
$objUpdatedLinks = $this->updateFieldDefLinks($obj, $fieldDefs);
$parsed[$module][] = $objUpdatedLinks;
}
}
return $parsed;
}
After adding continue; inside the 2nd if(!$obj) - the issue fixed.
Issue
Expected Behavior
Actual Behavior
Possible Fix
Steps to Reproduce
0 /data/www/html/SuiteCRM/7.11/lib/Search/UI/SearchResultsController.php(122): SuiteCRM\Search\SearchResults->getHitsAsBeans()
1 /data/www/html/SuiteCRM/7.11/lib/Search/SearchEngine.php(65): SuiteCRM\Search\UI\SearchResultsController->display()
2 /data/www/html/SuiteCRM/7.11/lib/Search/SearchEngine.php(41): SuiteCRM\Search\SearchEngine->displayResults(Object(SuiteCRM\Search\SearchQuery), Object(SuiteCRM\Search\SearchResults))
3 /data/www/html/SuiteCRM/7.11/lib/Search/SearchWrapper.php(77): SuiteCRM\Search\SearchEngine->searchAndDisplay(Object(SuiteCRM\Search\SearchQuery))
4 /data/www/html/SuiteCRM/7.11/modules/Home/Search.php(50): SuiteCRM\Search\SearchWrapper::searchAndDisplay(Object(SuiteCRM\Search\SearchQuery))
5 /data/www/html/SuiteCRM/7.11/include/MVC/View/SugarView.php(834): include_once('/data/www/html/...')
6 /data/www/html/SuiteCRM/7.11/include/MVC/View/views/view.classic.php(72): SugarView->includeClassicFile('modules/Home/Se...')
7 /data/www/html/SuiteCRM/7.11/include/MVC/View/SugarView.php(226): ViewClassic->display()
8 /data/www/html/SuiteCRM/7.11/include/MVC/Controller/SugarController.php(435): SugarView->process()
9 /data/www/html/SuiteCRM/7.11/include/MVC/Controller/SugarController.php(375): SugarController->processView()
10 /data/www/html/SuiteCRM/7.11/include/MVC/SugarApplication.php(113): SugarController->execute()
11 /data/www/html/SuiteCRM/7.11/index.php(52): SugarApplication->execute()
12 {main}
`
Context
Your Environment