Export of an index contains blank Module Dependency

Created on 26 November 2022, about 2 years ago
Updated 1 December 2023, about 1 year ago

Problem/Motivation

I am trying to move a Search_API configuration, and an associated View, from one site to another using the Drupal 9 YML export/import process.
The View import fails because of a dependency error, which turns out to be that the Search Index configuration contains a dependency on a module with a blank name. The View import is clearly checking for this module and can't find it.

A snippet of the YML file for the Index looks like:

  module:
    - ''
    - recurring_events

Steps to reproduce

This is with Drupal 9.4.8 and Search-API 8.x-1.28

The full YML export is attached. I have tried a simpler Index only using a couple of fields from a single Content type, and it does not show the fault.

Proposed resolution

There is a simple workaround which is to manually delete this line from the YML before importing it, which seems to have no adverse effects and allows the View to import. That is however another manual step, adding opportunity for error.

πŸ› Bug report
Status

Needs review

Version

1.28

Component

Framework

Created by

πŸ‡¬πŸ‡§United Kingdom maynardsmith

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡°Denmark doublejam

    Just ran into same problem

  • πŸ‡©πŸ‡ͺGermany pp.panatom

    Had the same issue.
    I had a computed (views) field in my index. I could fix that problem by removing that field from index

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Thanks for reporting this problem!
    However, as it doesn’t seem easily possible to reproduce this problem, I’d need help in investigating its root cause. The problem appears very likely somewhere in \Drupal\search_api\Entity\Index::getDependencyData(). Would you be able to step through that, or add debugging lines, to see when and from where the empty module dependency is added?

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria
  • πŸ‡ͺπŸ‡ΈSpain dcraig91

    I've the same problem creating and index to index content from https://www.drupal.org/project/recurring_events β†’ .

    In the index configuration i check: Event Instance entity, Event series entity and Registrant.

    I hope it helps you, this error is quite annoying.

  • πŸ‡¬πŸ‡§United Kingdom rattusrattus

    I had ran into this when indexing a computed field with an unset provider, e.g.

    $fields['computed_field'] = BaseFieldDefinition::create('string')
          ->setLabel(t('Example computed field'))
          ->setReadOnly(TRUE)
          ->setComputed(TRUE)
          ->setClass(ExampleComputedField::class)
          ->setDisplayConfigurable('form', FALSE)
          ->setDisplayConfigurable('view', TRUE)
          ->setProvider('example_computed_field'); // <---
    

    I haven't stepped through the code but would make sense given the following in `\Drupal\search_api\Entity\Index::getDependencyData()`:

    $type_dependencies[$type]['module'][] = $definition['provider'];
    
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.11 + Environment: PHP 8.2 & sqlite-3.34
    last update about 1 year ago
    545 pass
  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    That line doesn’t really refer to a field definition, but to a data type. Still, easy to check whether this might be the cause – please test the attached patch and see if it resolves the issue for you.

Production build 0.71.5 2024