-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
TimeField , DateTimeField and DateField cannot be deserialised from Json #16203
Comments
Thanks for the test! How exactly do you reproduce this with Field Indexing? |
Because this code will call the OrchardCore/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TimeFieldIndexProvider.cs Lines 70 to 83 in 8ef3a02
Lines 16 to 22 in 8ef3a02
|
I mean, how do you use Field Indexing that brings this bug out? |
I've created a recipe that, if you import it, you'll see detailed error messages in the logs, and I'm going to add it to the unit test {
"name": "dynamicIndexTest",
"displayName": "dynamicIndexTests",
"description": "Test dynamicIndex",
"author": "Tony Han",
"website": "",
"version": "1.0.0",
"issetuprecipe": false,
"categories": [ "test" ],
"tags": [],
"steps": [
{
"name": "Feature",
"enable": [ "OrchardCore.ContentFields.Indexing.SQL" ]
},
{
"name": "ContentDefinition",
"ContentTypes": [
{
"Name": "Message",
"DisplayName": "Message",
"Settings": {
"ContentTypeSettings": {
"Creatable": true,
"Draftable": true,
"Versionable": true,
"Listable": true,
"Securable": true
}
},
"ContentTypePartDefinitionRecords": [
{
"PartName": "Message",
"Name": "Message",
"Settings": {
"ContentTypePartSettings": {
"Position": "5"
}
}
},
{
"PartName": "DIndexPart",
"Name": "DIndexPart"
}
]
}
],
"ContentParts": [
{
"Name": "Message",
"Settings": {},
"ContentPartFieldDefinitionRecords": [
{
"FieldName": "TextField",
"Name": "TextFieldTest"
},
{
"FieldName": "MultiTextField",
"Name": "MultiTextFieldTest"
},
{
"FieldName": "HtmlField",
"Name": "HtmlFieldTest"
},
{
"FieldName": "MediaField",
"Name": "MediaFieldTest"
},
{
"FieldName": "BooleanField",
"Name": "BooleanFieldTest"
},
{
"FieldName": "TimeField",
"Name": "TimeFieldTest"
},
{
"FieldName": "DateTimeField",
"Name": "DateTimeFieldTest"
},
{
"FieldName": "DateField",
"Name": "DateFieldTest"
},
{
"FieldName": "NumericField",
"Name": "NumericFieldTest"
},
{
"FieldName": "ContentPickerField",
"Name": "ContentPickerFieldTest"
},
{
"FieldName": "UserPickerField",
"Name": "UserPickerFieldTest"
}
]
}
]
},
{
"name": "content",
"data": [
{
"ContentItemId": "testId1",
"ContentType": "Message",
"DisplayText": "Message",
"Latest": true,
"Published": true,
"Owner": "[js: parameters('AdminUserId')]",
"Author": "[js: parameters('AdminUsername')]",
"Message": {
"TextFieldTest": { "Text": "TextFieldTestValue" },
"MultiTextFieldTest": { "Values": [ "MultiTextFieldValue1", "MultiTextFieldValue2" ] },
"HtmlFieldTest": { "Html": "HtmlFieldTestValue" },
"MediaFieldTest": { "Paths": [ "Path1", "Path2" ] },
"BooleanFieldTest": { "Value": true },
"TimeFieldTest": { "Value": "12:05" },
"DateTimeFieldTest": { "Value": "2024-5-5 22:50:58" },
"DateFieldTest": { "Value": "2024-5-5" },
"NumericFieldTest": { "Value": 123 },
"ContentPickerFieldTest": { "ContentItemIds": [ "testContentItemId" ] },
"UserPickerFieldTest": { "UserIds": [ "TestUserID" ] }
},
"TitlePart": {
"Title": "[locale en]You have successfully registered![/locale][locale fr]Vous vous êtes inscrit avec succès![/locale]"
}
}
]
}
]
}
|
STJ only supports |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
Thanks for the details! All clear now. Since this breaks existing installations that use
Please let me know once the PR is ready. |
It looks like there is a similar problem with
|
So it's not related to SQL Indexing, right? It's just that indexing triggered the code path that was deserializing the document to a Could you share what JSON is saved with 1.8.3 (NSJ) in a document when using such fields? Just to confirm that it's NSJ that created this format, and that the DateTime format it used is also incompatible with STJ. This might be related to the culture when it saved the valus with NSJ. |
@sebastienros Maybe this unit test can verify this |
Describe the bug
I found this in my custom code, but if someone has enabled the
OrchardCore.ContentFields.Indexing.SQL
feature on OC 2.0 and is usingTimeField
they will run into this problem!To Reproduce
The text was updated successfully, but these errors were encountered: