Skip to content

Commit

Permalink
Index field_weight's value. (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey authored Jan 25, 2023
1 parent 4f4e661 commit fe7e450
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
indexes:
value:
- value
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* @file
* Post-update hooks.
*/

/**
* Add index to field_weight.
*/
function islandora_core_feature_post_update_add_index_to_field_weight() {
$storage = \Drupal::entityTypeManager()->getStorage('field_storage_config');
$field = $storage->load('node.field_weight');
$indexes = $field->getIndexes();
$indexes += [
'value' => ['value'],
];
$field->setIndexes($indexes);
$field->save();
}

0 comments on commit fe7e450

Please sign in to comment.