Recent changes to search_api break the index-parallel drush command.
Setup
- Solr version: 8.11.4
- Drupal Core version: 10.5.5.
- Search API version: 1.40
- Search API Solr version: 4.3.10
Issue
After updating search_api to v1.40, I get the following error message when running drush search-api-solr:index-parallel solr:
Fatal error: Declaration of Drupal\search_api_solr\Utility\IndexParallelBatchHelper::create(Drupal\search_api\IndexInterface $index, $batch_size = null, $limit = -1): array must be compatible with Drupal\search_api\IndexBatchHelper::create(Drupal\search_api\IndexInterface $index, $batch_size = null, $limit = -1, int $time_limit = -1) in /opt/drupal/web/modules/contrib/search_api_solr/src/Utility/IndexParallelBatchHelper.php on line 35
Digging in a little on my own, it seems like it is related to at least 2 recent changes to search_api:
- search_api #3530660 adds a time_limit option to search-api:index
- search_api #351144 makes IndexBatchHelper a service.
Steps to Reproduce
In a project with a working solr index:
- Update search_api to v1.40:
composer require 'drupal/search_api:^1.40' - clear your solr index:
drush search-api-solr:delete-all <server_id> - run an index:
drush search-api-solr:index-parallel solr
Comments
Comment #2
eduardo morales albertiSame here, by the moment we use the command `drush search-api:index` to avoid the error.
Comment #4
mkalkbrennerAs a quick fix I copied the removed functions. But the real fix should migrate the code to the new service:
https://git.drupalcode.org/project/search_api/-/commit/0582b3863fc60533c...
Comment #6
mkalkbrennerComment #8
dmezquiaYes, adding the functions as a temporary solution (#4) worked fine for me.
Comment #10
la558 commentedSomething must had happened;
After 4 months; I re enabled the autocomplete module; and the site did not crash this time.
Thanks!
Comment #11
sbrenner02 commentedencountering this in 1.41