I am currently getting an issue were the Solarium\Client cannot be found. I have installed it through composor but still same result.

I have found that clearing the cache fixes it until you visit a few more pages and then back to the same result.

Fatal error: Class 'Solarium\Client' not found in/docroot/modules/search_api_solr/src/Plugin/search_api/backend/SearchApiSolrBackend.php on line 1100

Comments

jagmitg created an issue. See original summary.

mkalkbrenner’s picture

How did you install solarium exactly?
Where is the vendor folder containing solarium located?

jagmitg’s picture

I installed it through the composer builder on the docroot folder composer update and also on the module itself.

There is a folder called vendor under the module folder and in that, there is a folder called search_api_solr/vendor/solarium/solarium/ with all the relevant files.

berdir’s picture

That's not correct, it must be part of the main vendor folder. See https://www.drupal.org/node/2404989 and specifically https://www.drupal.org/node/2718229.

jagmitg’s picture

I have just checked the main vendor folder as well, that also has an instance of solarium/solarium in it.

What else could be the issue?

mkalkbrenner’s picture

I highly recommend to do a fresh install following the instructions on https://www.drupal.org/node/2718229

That's how we do it in our automated tests as well.

mac_weber’s picture

Status: Active » Needs review

Simpler instructions can also be found here: Search API Solr - Drupal 8 Server setup
This page is specific for Search API Solr using Composer Manager

frankcarey’s picture

Shouldn't there be some checking and a proper error created from the code instead of allowing a fatal php error?

jagmitg’s picture

I have now removed all installation, removed the current implementation of solarium on both vendor folders (root and module), removed the module and did a fresh update of composer. yet i am still getting the issue. I was on the server page this time and under the server status, i was getting a solarium not found (on my current drupal installation).

I have also installed composer manager as well and that specifically lists that solarium is installed and its `Required by: Solr search`. However, still getting the result.

I dont really want to do a fresh installation but here are some of the logs:

Notice: Undefined index: /replication in Drupal\search_api_solr\Solr\SolrHelper->getStatsSummary() (line 513 of /docroot/modules/search_api_solr/src/Solr/SolrHelper.php).

Notice: Undefined index: autocommit maxTime in Drupal\search_api_solr\Solr\SolrHelper->getStatsSummary() (line 504 of /docroot/modules/search_api_solr/src/Solr/SolrHelper.php).

and then the fatal error.

mkalkbrenner’s picture

Shouldn't there be some checking and a proper error created from the code instead of allowing a fatal php error?

No. This problem isn't specific to Search API Solr but affects any module with composer managed dependencies. There's a core issue to deal with that: #2494073: Prevent modules which have unmet Composer dependencies from being installed.

In the past there were different approaches about how to deal with third party libraries, which isn't only a technical issue but also legal one regarding incompatible licenses. The way to go is described at https://www.drupal.org/node/2718229 and I don't think that we should support anything else.

Simpler instructions can also be found here: Search API Solr - Drupal 8 Server setup
This page is specific for Search API Solr using Composer Manager

Don't do that! The reason is stated on the composer manager's project page:

The Drupal 8 version of this module is deprecated and no longer needed, due to improvements in Drupal 8.1. Use Composer directly to get the needed modules, which will also download their required libraries.

@jagmitg:

  1. backup your installation and your database
  2. reinstall drupal core code base and the required contrib modules as described at https://www.drupal.org/node/2718229 , but don't run the installation wizard!
  3. replace settings.php by the one from your backup
  4. run drush updb
  5. tell us if it works ;-)

As already said in #2687197: Verify the composer managed dependencies using hook_requirements() we'll adjust our installation instructions accordingly. I think that this will happen when we turn beta here.

jagmitg’s picture

@mkalkbrenner Very good call. Worked perfectly when going through all composer setup. It was due to the cache refreshing but i will keep my installation all on composer now.

Thanks :)

mkalkbrenner’s picture

Category: Bug report » Support request
Status: Needs review » Fixed

Great to hear :-)
Thanks for reporting back.

mac_weber’s picture

@mkalkbrenner thanks for pointing that. I updated the instructions there: https://www.drupal.org/node/2763131

mkalkbrenner’s picture

@Mac_Weber: Thanks for contributing documentation!

Status: Fixed » Closed (fixed)

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

criscom’s picture

Hi Michael,

I tried your approach in #10. It worked perfectly for me.

Some issues I found:

- I had to re-create all my pages built with panels and page_manager (no big deal)
- I had been getting Warning: mkdir(): Permission denied in Drupal\Component\PhpStorage\FileStorage->createDirectory() - so fixing the file permissions took some time.

Overall, all went well! Thanks a lot!

criscom’s picture

It turned out that the fix in #10 broke the translation functionality on the site. I can no longer translate nodes, getting an unexpected error like:

Drupal\Core\Entity\EntityStorageException: Invalid translation language (de) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 770 of /var/www/bibliothek0.medunigraz.at/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

hanmant.sapkal’s picture

This is what helped me... https://www.drupal.org/node/2763131
Use composer to download both search_api and search_api_solr modules. This will ensure dependency downloads too. And then use drush to enable modules. The Solarium library needs to be in root vendor directory.

ressa’s picture

Using Composer does help getting all dependencies. The slightly annoying thing is that the modules are put in the modules folder, not modules/contrib, where I keep modules from d.o. I don't know if there is a way to define this?

berdir’s picture

That's described on the linked page: https://www.drupal.org/node/2718229

Look for "Define the directories to which Drupal projects should be downloaded"

ressa’s picture

Thanks @Berdir, I should probably have written that I use a make file, and not Composer to manage my project, so I can't use that solution.

alexmoreno’s picture

no need to reinstall anything, simply this should do the trick:

composer require drupal/search_api_solr