-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrades to enumeration fields and queries related to them #8801
base: 1.10.x
Are you sure you want to change the base?
Upgrades to enumeration fields and queries related to them #8801
Conversation
Forced value update between Updating and Updated handler invocations.
@@ -36,9 +36,12 @@ public void Describe(DescribeFilterContext describe) { | |||
continue; | |||
} | |||
|
|||
// Exclude EnumerationFields, that use a specific IFilterProvider | |||
var fields = part.Fields.Where(fd => !fd.FieldDefinition.Name.Equals("EnumerationField")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be an acceptable solution. The upgrade should make things right such that not such hack is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented on the issue, let's discuss there.
In reference to issue #8800, which solves a compatibility issue added by #8789 , I added an Upgrade procedure (inside the Upgrade module) that saves / publishes again every content item which contains an EnumerationField in the definition of its parts. This is needed to ensure that both the content item's infoset and the string field index records used by the projections for the enumeration fields' values are in the new format (with ";" separator characters at the beginning and at the end of the value).
I didn't use a migration step because of the lenght of the procedure (potentially saving thousands of content items for each tenant) and to be able to schedule the long update script to be asynchronous.
As discussed and explained in the issue thread, I also implemented a new IFilterProvider, specific for EnumerationFields, that processes the values for the query in order to ensure that old queries still work. This solves an issue which is specific to single choice EnumerationFields, the value of which is now in the format of ";value;" instead of "value" (without the semicolons). Appropriate semicolons are added for Equals/NotEquals, StartsWith/NotStartsWith and EndsWith/NotEndsWith string operators, the ones who were affected by #8789 .
This new filter provider has the same category and name of the original ContentFieldsFilterProvider (modificed accordingly to exclude EnumerationFields from its execution) and, for this reason, old queries work properly without the need of a migration, using the new, specific provider.
The Upgrade step has to be executed manually for each tenant in order to make the new filter provider to work properly. If upgrade isn't executed, EnumerationFields with the old value format will not be "found" by the queries if they are filtered with Equals/NotEquals, StartsWith/NotStartsWith or EndsWith/NotEndsWith string operators.