protected function SearchApiSolrBackend::indexFieldsUpdated in Search API Solr 8.3
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::indexFieldsUpdated()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::indexFieldsUpdated()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::indexFieldsUpdated()
Checks if the recently updated index had any fields changed.
Parameters
\Drupal\search_api\IndexInterface $index: The index that was just updated.
Return value
bool TRUE if any of the fields were updated, FALSE otherwise.
1 call to SearchApiSolrBackend::indexFieldsUpdated()
- SearchApiSolrBackend::updateIndex in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php - Notifies the server that an index attached to it has been changed.
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 943
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
protected function indexFieldsUpdated(IndexInterface $index) {
// Get the original index, before the update. If it cannot be found, err on
// the side of caution.
if (!isset($index->original)) {
return TRUE;
}
/** @var \Drupal\search_api\IndexInterface $original */
$original = $index->original;
$old_fields = $original
->getFields();
$new_fields = $index
->getFields();
if (!$old_fields && !$new_fields) {
return FALSE;
}
if (array_diff_key($old_fields, $new_fields) || array_diff_key($new_fields, $old_fields)) {
return TRUE;
}
$old_field_names = $this
->getSolrFieldNames($original, TRUE);
$new_field_names = $this
->getSolrFieldNames($index, TRUE);
return $old_field_names != $new_field_names;
}