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 to parent::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 on database_settings keys.

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:

  1. AI Core ai.info.yml is missing a drupal:file dependency (the ai_file entity's local_file field targets the core file entity). This is an ai (AI Core) issue, not ai_search.
  2. The test mock provider infrastructure is built on the now-removed standalone AiProvider plugin model. AiProviderPluginManager::getProvidersForOperationType() now only resolves ai_platform_config entities, 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.

Merge request reports

Loading