Doesn't work when installed via git, e.g. local testing

Created on 20 March 2025, 21 days ago

Setup

  • Solr version: 8
  • Drupal Core version: 11.1.x
  • Search API version: 8.x-1.x
  • Search API Solr version: 4.x
  • Configured Solr Connector: none

Issue

If you download the module via git, e.g. for local testing or working on d.o issues, the module doesn't work. This happens because the module checks Composer to see what release is installed:

namespace Drupal\search_api_solr\Plugin\search_api\backend;

use Composer\InstalledVersions;
..
class SearchApiSolrBackend extends BackendPluginBase implements SolrBackendInterface, PluginFormInterface {
..
  public function getPreferredSchemaVersion(): string {
    $installed_version = InstalledVersions::getPrettyVersion('drupal/search_api_solr');

    if (!preg_match('/^\d+\.\d+\.\d+$/', $installed_version, $matches)) {
      return self::SEARCH_API_SOLR_MIN_SCHEMA_VERSION;
    }

    return $installed_version;
  }

If you download the module via git, and manually download the dependencies via composer, this code won't work as "drupal/search_api_solr" is not defined in Composer's index.

πŸ› Bug report
Status

Active

Version

4.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024