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:

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

sgraham42 created an issue. See original summary.

eduardo morales alberti’s picture

Same here, by the moment we use the command `drush search-api:index` to avoid the error.

  • mkalkbrenner committed 4c495b86 on 4.x
    search_api v1.40 breaks drush search-api-solr:index-parallel, related to...
mkalkbrenner’s picture

Status: Active » Needs work

As 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...

mkalkbrenner’s picture

Version: 4.3.10 » 4.x-dev
Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

dmezquia’s picture

Yes, adding the functions as a temporary solution (#4) worked fine for me.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

la558’s picture

Something must had happened;
After 4 months; I re enabled the autocomplete module; and the site did not crash this time.
Thanks!

sbrenner02’s picture

encountering this in 1.41