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
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3382226-22--solr_version_check_bug.patch | 3.26 KB | drunken monkey |
Issue fork search_api_autocomplete-3382226
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
Comment #2
gaspounet commentedComment #3
keshavv commentedThere is no constant with name
SEARCH_API_SOLR_SCHEMA_VERSIONin Search Api Solr module.use
SEARCH_API_SOLR_MIN_SCHEMA_VERSIONinstead.Comment #4
gaspounet commentedThank 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!
Comment #5
manu manuCan confirm the patch in #3 fixes the issue, thank you @keshavvv.
Switching to RTBC
Comment #7
trickfun commentedIt works. thank you
Comment #8
hongqing commentedThanks. It works with Drupal 10.1.4 and Search Api autocomplete 8.x-1.7
Comment #9
2dareis2do commentedSame 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...
Comment #10
claudiu.cristeaWell, 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.
Comment #11
claudiu.cristeaAlso, the old constant has been deprecated prior to be deleted. See https://git.drupalcode.org/project/search_api_solr/-/commit/cdf4b1fdc973... :
The deprecation notice recommends use of
SearchApiSolrBackend::getPreferredSchemaVersion().Comment #14
bvoynickUpdated MR to use the method, and to fall back to the old < 4.3.0 constant if the method does not exist.
Comment #15
bvoynickComment #16
laura.gates#13's patch works for me and clears the white screen of death on /admin/reports/status
Comment #17
jwilson3RTBC++ We're currently using this one to charge forward with D10 upgrades on a client project.
Comment #18
2dareis2do commentedThanks @bvoynick. Looks good to me but is quite difficult to read.
Comment #19
rar9 commented+1 3382226-3.patch working well status update displays again
Comment #20
joseph.olstad+1 , hitting this and going to use the patch #13
our /admin/config route is blown otherwise
Comment #21
trickfun commentedIt works.
Thank you
Comment #22
drunken monkeyThanks 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_autocompletemodule is even available. If thegetPreferredSchemaVersion()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.
Comment #23
lonalore#22 patch works for me. Drupal 9.5.11 with Search API Solr 4.3.0.
Comment #24
joseph.olstadNice work Thomas! Your code comments are very helpful to understand what's going on.
Comment #25
2dareis2do commentedThanks 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.
Comment #26
skaughtalso to help confirm:
tested patch #22 on local setup of client works!
Comment #28
drunken monkeyGreat to hear, thanks for all your comments.
Merged this. Thanks again, everyone!
I’ll try to create a new release soon.
Comment #30
daaira commentedtested patch #22 and worked for me.
Thanks, drunken monkey
Comment #31
jaydip makawana commentedPatch is merged and released as part of '8.x-1.8'.