Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
GitHub Issue: (link)
Release pull requests, etc.)
What does this Pull Request do?
Adds indexing in the DB for the
value
of thefield_weight
field, given it its intent is to sort things, which indexing can facilitate.This DB indexing behaviour is not configurable via Drupal's GUI, and so gets into something of a weird place, essentially requiring code to manipulate it. Given this field is/was originally defined in
islandora_core_feature
, it seemed like the place to put this.What's new?
Addition of index to for the field on install, and a post-update hook to start indexing it in existing installations.
(i.e. Regeneration activity, etc.)? No.
How should this be tested?
SHOW INDEX FROM node__field_weight;
, but haven't tested suchdrush updb
or otherwise), it should find the post-update hook.node__field_weight__field_weight_value__idx
bit, in the case of PostgreSQL):As for testing the installation side of things, not sure. Not sure there's any extant mechanism for performing the installation directly from the modules, without other configuration being imported which might interfere? I... suppose one might try installing the updated
islandora_core_feature
into a plain Drupal site, and see that the index gets populated?Documentation Status
Additional Notes:
Ironically, playing around with
EXPLAIN ANALYZE
ing Drupal-generated queries in PostgreSQL, this index doesn't appear to be used. Other than other heuristics involving the size of the table, I suspect it is due to Drupal changing the ordering ofNULL
to be first, inline with MySQL/MariaDB/etc in queries, but indexes being left in their default ordering ofNULL
-last, and so to be incompatible with sorting operations.Interested parties
Tag (@ mention) interested parties or, if unsure, @Islandora/committers