Issue #3584015: Fix 2.x branch integration with AI 2.x
Problem
The functional test AiSearchSetupMySqlTest fails against AI Core 2.0.x after the Symfony Platform integration (#3574187). This MR addresses the failures that occur within the ai_search backend itself.
What this MR changes
SearchApiAiSearchBackend calls getVectorDb() in several places without checking whether a vector database backend has actually been selected yet. getVectorDb() calls vdbProviderManager->createInstance($this->configuration['database']), which throws PluginNotFoundException when database is empty/NULL. This happens during the multi-step Search API server configuration form, before the database is chosen.
Guards added (mirroring the existing pattern already used in search() and validateConfigurationForm()):
ensureCollectionExists()— returns early (TRUE, nothing to create) when no database is selected.calculateDependencies()— falls back toparent::calculateDependencies()when no database is selected.viewSettings()— returns the basic info early and avoids instantiating the VDB provider when no valid database is selected; plus defensive null-coalescing ondatabase_settingskeys.
Testing
These changes let the server configuration flow complete without fatal errors. Reproduced locally with the command from the issue (adjusted for a web/ docroot).
Out of scope / follow-ups (see issue comment)
Two further blockers remain that are not in this MR because they are either in another module or require a design decision:
- AI Core
ai.info.ymlis missing adrupal:filedependency (theai_fileentity'slocal_filefield targets the corefileentity). This is anai(AI Core) issue, notai_search. - The test mock provider infrastructure is built on the now-removed standalone
AiProviderplugin model.AiProviderPluginManager::getProvidersForOperationType()now only resolvesai_platform_configentities, so the test mocks need reworking onto the 2.x platform model. This is the core breaking change referenced in the issue and relates to #3485449.
Details and full analysis in the issue comment.