Problem/Motivation

The configuration of Facet source current does not have a dependency on the source configuration. This creates an issue when configuration is split over different sync directories in a multsite setup, for example using the Config Split contributed module.

Assume a configured view 'Search' with a display 'Page'. The exported facet source configuration then looks like this:

uuid: 5c5f91a8-1047-44a2-8213-6fa44a691a5f
langcode: en
status: true
dependencies: {  }
id: search_api__views_page__search__page
name: 'search_api:views_page__search__page'
filter_key: null
url_processor: query_string
breadcrumb: {  }

Proposed resolution

Add a dependency on the source configuration, so the exported configuration looks like this:

uuid: 5c5f91a8-1047-44a2-8213-6fa44a691a5f
langcode: en
status: true
dependencies:
  config:
    - search_api.index.default
    - views.view.search_page
id: search_api__views_page__search__page
name: 'search_api:views_page__search__page'
filter_key: null
url_processor: query_string
breadcrumb: {  }

As a result, exporting a view to a split configuration directory correctly moves the facet source configuration to the target directory.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

The exported configuration files have a new dependency on source configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

borisson_’s picture

You are right, this is correct. I tried fixing this but I don't know how.

borisson_’s picture

Status: Active » Needs review
FileSize
908 bytes

In theory, this should be enough, I think.

Status: Needs review » Needs work

The last submitted patch, 3: 2927098.patch, failed testing. View results

borisson_’s picture

Status: Needs work » Needs review
FileSize
585 bytes
985 bytes

Should fix that test.

idebr’s picture

Status: Needs review » Needs work

An example of the current dependency chain is 'Facet: field_tags' -> 'Facet source: View Search content, display Page' -> 'View: Search, display page'. The current patch adds a dependency the wrong way: from facet source to the facet.

idebr’s picture

Title: Facet source configuration have a dependency on the source object » Facet source configuration should have a dependency on the source object
andypost’s picture

I think only view should be added to dependency which in turn will provide dependency on index

borisson_’s picture

I think only view should be added to dependency which in turn will provide dependency on index

Well, we can also have Search API pages as a source, instead of a view, we also have the core search facets that provide a facetsource with core search.

So just adding this to view doesn't seem like that would be easy to do. I'm not sure how we should do this instead though.

borisson_’s picture

Status: Needs work » Needs review
FileSize
2.53 KB
2.96 KB
borisson_’s picture

FileSize
3.52 KB
2.87 KB

I think this is a good start.

borisson_’s picture

Status: Needs review » Needs work

Needs work, the tests should be fixed, probably by checking if the plugin exists before creating an instance of it.