When you export a search_api server definition to a feature it does not list the module that provides the storage engine as a dependency. This is particularly problematic when the feature is used in an installation profile as it causes the installation to fail. In both circumstances, if the relevant module is not already enabled it will fail with the following error:
SearchApiException: Search server with machine name site_db specifies illegal service class search_api_db_service. in SearchApiServer->ensureProxy() (line 133 of search_api/includes/server_entity.inc).

Continued from #1593312: SearchApiException: Search server with machine name site_db specifies illegal service class search_api_db_service.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
1.41 KB

This patch resolves the problem. It uses hook_features_export_alter() to run through the list of exported server specifications, loads each one and then works out what module is responsible for generating it - if the module isn't in the dependencies list it is added.

drunken monkey’s picture

Wow, thanks a bunch!
I knew this had to be possible somehow. Great that you found and implemented that!

Could someone with that problem please verify that the patch works as intended?

DamienMcKenna’s picture

This patch fixes the bug from #1630130: Warning: ksort() expects parameter 1 to be array, string given in search_api_features_export_alter() - I had a #facepalm-worthy bug regarding the ksort() line at the end of the patch.

drunken monkey’s picture

Status: Needs review » Fixed

The usual enthusiasm regarding the testing of patches …
But OK, I'll just take your word that the patch works. ;)

Committed. Thanks a lot for your work!

Status: Fixed » Closed (fixed)

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