Add support for mapped field

Created on 6 October 2022, over 2 years ago
Updated 25 June 2024, 7 months ago

Problem/Motivation

When trying to add a facet for a mapped field, the following error is thrown:
Error: Call to undefined method Drupal\search_api_field_map\Plugin\search_api\processor\Property\MappedFieldProperty::getFieldDefinition() in Drupal\facets_range_datepicker_widget\Plugin\facets\processor\DatepickerProcessor->supportsFacet() (line 84 of modules/contrib/facets_range_datepicker_widget/src/Plugin/facets/processor/DatepickerProcessor.php).

This is because supportsFacet method is assuming that the facet source is an index field that is created from an entity field.

Steps to reproduce

  1. Form the index fields page click on "Add fields"
  2. Choose "Mapped field"
  3. Fill in the desired mapped data which can have different types on different bundles or entity types
  4. Hit "Save" then "Done"
  5. Optionally change the field type to "Date"
  6. Go to facets page and add a facet
  7. Choose the field created previously as the source field and hit "Save"

Proposed resolution

Modify supportsFacet method to check the index field type instead of checking the entity field type.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

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.

Production build 0.71.5 2024