Problem/Motivation
I noticed in
📌
The whole index gets cleared when any change in the search index configuration is imported
Active
, the test in Drupal\Tests\elasticsearch_connector\Functional\ManualConfigIndexTest::testIndexIntactAfterNoChange
started failing after
✨
Highlighting support (leverage Elasticsearch highlighting)
Needs review
.
Investigating, it seems like trying to save the Manage processors for search index form at /admin/config/search/search-api/index/INDEX_NAME/processors
was failing to validate with the following error:
Fields to highlight field is required
When I made the field not-required to test...
diff --git a/src/Plugin/search_api/processor/ElasticsearchHighlighter.php b/src/Plugin/search_api/processor/ElasticsearchHighlighter.php
index 364112e..fcef094 100644
--- a/src/Plugin/search_api/processor/ElasticsearchHighlighter.php
+++ b/src/Plugin/search_api/processor/ElasticsearchHighlighter.php
@@ -45,7 +45,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
'#title' => $this->t('Fields to highlight'),
'#description' => $this->t('The fields to search for highlights in, and to display highlights for.'),
'#default_value' => $config['fields'],
- '#required' => TRUE,
+ '#required' => FALSE,
'#multiple' => TRUE,
'#options' => $this->getFieldOptions($this->index),
];
... the test passed, so that's the problem.
Steps to reproduce
(see description)
Proposed resolution
Make sure $form['fields']
is only required when the elasticsearch_highlight
processor is active.
Remaining tasks
- Write a patch
- Review and feedback
- RTBC and feedback
- Commit
- Release
User interface changes
The "Elasticsearch Highlighter" processor's "Fields to highlight" field is only required when the processor is enabled.
API changes
None.
Data model changes
None.