Problem/Motivation

On an instance of Drupal core 10.1.2 with Search API 8.x-1.29 and Search API Autocomplete 8.x-1.7 modules installed and after:

- a fresh installation of a self-hosted Solr server version 9.3.0
- an update of the module Search API Solr from version 4.2.12 to 4.3.0-alpha1
- configurating successfully the new server and some indexes on /admin/config/search/search-api

When accessing some pages as /admin/config/search/search-api/index/[SOME_INDEX]/autocomplete and, way more problematic, the page /admin/reports/status, I've got an error 500 with the following messages inside my weblogs:

AH01071: Got error 'PHP message: Uncaught PHP Exception Error: "Undefined constant Drupal\\search_api_solr\\SolrBackendInterface::SEARCH_API_SOLR_SCHEMA_VERSION" at <ROOT>/modules/contrib/search_api_autocomplete/search_api_autocomplete.install line 19'

AH01071: Got error 'PHP message: Uncaught PHP Exception Error: "Undefined constant Drupal\\search_api_solr\\SolrBackendInterface::SEARCH_API_SOLR_SCHEMA_VERSION" at <ROOT>/modules/contrib/search_api_autocomplete/src/Form/IndexOverviewForm.php line 136'

Proposed resolution

Tried to clear the the cache several times, not changing anything
Activation of the module Search API Solr Autocomplete changes nothing too
The only way to remove the errors is to remove the module Search API Autocomplete

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gaspounet created an issue. See original summary.

gaspounet’s picture

Issue summary: View changes
keshavv’s picture

Status: Active » Needs review
StatusFileSize
new1.62 KB

There is no constant with name SEARCH_API_SOLR_SCHEMA_VERSION in Search Api Solr module.
use SEARCH_API_SOLR_MIN_SCHEMA_VERSION instead.

gaspounet’s picture

Thank you very much @keshavv for this patch, I can confirm that the error messages have disappeared now and that I can use again the autocomplete feature!

manu manu’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm the patch in #3 fixes the issue, thank you @keshavvv.

Switching to RTBC

ayush9598 made their first commit to this issue’s fork.

trickfun’s picture

It works. thank you

hongqing’s picture

Thanks. It works with Drupal 10.1.4 and Search Api autocomplete 8.x-1.7

2dareis2do’s picture

Same here. Many thanks for the fix. This looks like the commit that has broken this:

https://git.drupalcode.org/project/search_api_solr/-/commit/cdf4b1fdc973...

claudiu.cristea’s picture

Status: Reviewed & tested by the community » Needs work

Well, it works but what if search_api_solr has an older version where the old constant has been used? I think the existence of each constant should be checked.

claudiu.cristea’s picture

Also, the old constant has been deprecated prior to be deleted. See https://git.drupalcode.org/project/search_api_solr/-/commit/cdf4b1fdc973... :

  /**
   * The current Solr schema version.
   *
   * @deprecated use getPreferredSchemaVersion()
   */
  public const SEARCH_API_SOLR_SCHEMA_VERSION = '4.2.13';

The deprecation notice recommends use of SearchApiSolrBackend::getPreferredSchemaVersion().

bvoynick made their first commit to this issue’s fork.

bvoynick’s picture

Updated MR to use the method, and to fall back to the old < 4.3.0 constant if the method does not exist.

bvoynick’s picture

Status: Needs work » Needs review
laura.gates’s picture

Status: Needs review » Reviewed & tested by the community

#13's patch works for me and clears the white screen of death on /admin/reports/status

jwilson3’s picture

RTBC++ We're currently using this one to charge forward with D10 upgrades on a client project.

2dareis2do’s picture

Thanks @bvoynick. Looks good to me but is quite difficult to read.

rar9’s picture

+1 3382226-3.patch working well status update displays again

joseph.olstad’s picture

+1 , hitting this and going to use the patch #13
our /admin/config route is blown otherwise

trickfun’s picture

It works.
Thank you

drunken monkey’s picture

Version: 8.x-1.7 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.64 KB
new3.26 KB

Thanks a lot for reporting this problem and providing several great patches.

However, checking #3257941: Mention search_api_solr_autocomplete confirms that the only reason we compare the schema version is to detect whether the search_api_solr_autocomplete module is even available. If the getPreferredSchemaVersion() method exists, then that just means that the Solr module version is even newer and we don’t even need to check the version number.

I think the attached patch is a lot easier to read and should work just as well, no matter which Solr module version you’re using.
Please give it a try (and/or review) and I can commit it.

lonalore’s picture

Status: Needs review » Reviewed & tested by the community

#22 patch works for me. Drupal 9.5.11 with Search API Solr 4.3.0.

joseph.olstad’s picture

Nice work Thomas! Your code comments are very helpful to understand what's going on.

2dareis2do’s picture

Thanks drunken monkey.

Latest patch installed and working for me on dev/production environments.

Had to delete and recreate the collection locally for some reason but that was probably caused by an earlier update.

Much easier to read.

skaught’s picture

also to help confirm:
tested patch #22 on local setup of client works!

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Great to hear, thanks for all your comments.
Merged this. Thanks again, everyone!
I’ll try to create a new release soon.

daaira’s picture

tested patch #22 and worked for me.
Thanks, drunken monkey

jaydip makawana’s picture

Patch is merged and released as part of '8.x-1.8'.

Status: Fixed » Closed (fixed)

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