1

I want to use Search API + Solr on my Drupal (& Drupal commerce) site. The tutorials recommend to uninstall the core Search module. However, I can't: the UI at page /admin/modules has Search module checked and grayed out and trying drush pmu search results in the following output:

In ModuleInstaller.php line 432:
                                                                                                          
The following reasons prevent the modules from being uninstalled: The Commerce Base module is required

I am using Drupal 9.4.5, with all modules up-to-date. I installed it with the commerce_base installation profile as suggested at https://docs.drupalcommerce.org/commerce2/developer-guide/install-update/installation.

I didn't try it on a fresh install, but even if it works there, I would prefer to be able to modify my site as needed rather than starting from scratch -- any ideas how to start debugging this?

2 Answers 2

0

The Search API module isn't a drop-in replacement for the Search module. This means that modules that expect the Search module to be installed won't work if you replace the Search module with the Search API module.

It could also be the Commerce Base profile copied its dependencies from the Standard profile and included the Search module, even if that module isn't necessary, or the Commerce Base profile dependencies haven't been updated and the Search module is now not required. In these cases, uninstalling the Search module and replacing it with the Search API module won't cause any issue on the site.

You can verify this is the case by creating a test site where the Composer Base dependencies are changed to exclude the Search module and include the Search API module and checking everything works as expected, including other Commerce modules you are using on your site.
(It could be there are Commerce modules that require the Search module but don't add it as their dependency, thinking the Search module is already a dependency for the Commerce Core module or any other Commerce module they need.)

On the issue queue for the Commerce Base profile, there is Replace core search with Search API, which is stalled since July 24, 2017 (the day that issue has been created).

0

I think what you are asking is not possible commerce_base requires the core search module. I mean that you are not encountering a bug but rather a consequence of using that install profile.

4
  • Thanks! So, if I edited the commerce_base.info.yml file (say replacing search with search_api), I would be able to uninstall the module I suppose. Is it a terrible idea -- or will search_api work as a replacement?
    – rs211
    Sep 4, 2022 at 9:58
  • If the Search module is effectively used by one of the modules installed by the Commerce Base profile, it won't work, since the Search API module doesn't implement the same classes/functions/methods implemented by the Search module. Even a view that uses a plugin that takes data from the Search module won't work.
    – apaderno
    Sep 5, 2022 at 7:19
  • It could also be the Commerce Base profile copied its dependencies from the Standard profile, and included the Search module even if that module isn't necessary. To verify this is the case, you should create a test site and check what happens when the profile dependencies are changed as you described in your comment.
    – apaderno
    Sep 5, 2022 at 7:24
  • 1
    As a side note, Replace core search with Search API is a Commerce Base issue opened in 2017. Since then, there have not been any progress.
    – apaderno
    Sep 5, 2022 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.