Skip to content

Commit

Permalink
Issue #3392628 by mkalkbrenner: Don't build suggesters if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Kalkbrenner authored and mkalkbrenner committed Nov 1, 2023
1 parent bf4f5e0 commit bd570cf
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions search_api_solr.module
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,21 @@ function search_api_solr_cron() {
}

if ($is_drupal_only_writeable[$server->id()] && \Drupal::state()->get('search_api_solr.' . $server->id() . '.last_build', 0) < $last_update_on_server[$server->id()]) {
$query = $connector->getSuggesterQuery();
$query->addParam('suggest.buildAll', TRUE);
$connector->execute($query);
$suggester = TRUE;

foreach ($backend->getDisabledRequestHandlers() as $disabledRequestHandler) {
if (str_starts_with($disabledRequestHandler, 'request_handler_suggest_')) {
$suggester = FALSE;
break;
}
}

if ($suggester) {
$query = $connector->getSuggesterQuery();
$query->addParam('suggest.buildAll', TRUE);
$connector->execute($query);
}

\Drupal::state()->set('search_api_solr.' . $server->id() . '.last_build', $request_time);
}
}
Expand Down

0 comments on commit bd570cf

Please sign in to comment.