umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.49k stars 2.69k forks source link

Rebuilding of External Index, following upgrade #14560

Closed pritesh-tailor closed 1 year ago

pritesh-tailor commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

10.6.1

Bug summary

Since we upgraded to the recent security patch release, going from 10.4.2, the external index doesn't seem to be indexing particular pages and we've been getting the following error, 'System.InvalidOperationException: Cannot assign value "20/01/2023 09:00:00" of type "System.String" to property "openingTime" expecting type "System.DateTime".' Full stack trace in the specifics.

Specifics

The indexes aren't being correctly built, either on start up or when you use the 'Rebuild index' functionality within 'Settings', 'Examine Management', 'External Index'. The issue can be bypassed when you 'Publish with descendants' on the parent content. The full stack trace of the error is...

System.InvalidOperationException: Cannot assign value "20/01/2023 09:00:00" of type "System.String" to property "openingTime" expecting type "System.DateTime". at Umbraco.Cms.Core.Models.Property.ThrowTypeException(Object value, Type expected, String alias) at Umbraco.Cms.Core.Models.Property.TryConvertAssignedValue(Object value, Boolean throwOnError, Object& converted) at Umbraco.Cms.Core.Models.Property.SetValue(Object value, String culture, String segment) at Umbraco.Cms.Core.PropertyEditors.NestedPropertyIndexValueFactoryBase2.GetNestedResults(String keyPrefix, String culture, String segment, Boolean published, IDictionary2 propertyTypeDictionary, TItem nestedContentRowValue, IEnumerable1 availableCultures)+MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at Umbraco.Cms.Core.PropertyEditors.NestedPropertyIndexValueFactoryBase2.Handle(TSerialized deserializedPropertyValue, IProperty property, String culture, String segment, Boolean published, IEnumerable1 availableCultures) at Umbraco.Cms.Core.PropertyEditors.JsonPropertyIndexValueFactoryBase1.GetIndexValues(IProperty property, String culture, String segment, Boolean published, IEnumerable1 availableCultures) at Umbraco.Cms.Infrastructure.Examine.BaseValueSetBuilder1.AddPropertyValue(IProperty property, String culture, String segment, IDictionary2 values, IEnumerable1 availableCultures) at Umbraco.Cms.Infrastructure.Examine.ContentValueSetBuilder.GetValueSetsEnumerable(IContent[] content, Dictionary2 creatorIds, Dictionary2 writerIds)+MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at Umbraco.Cms.Infrastructure.Examine.ExamineUmbracoIndexingHandler.DeferedReIndexForContent.<>c__DisplayClass6_0.<Execute>b__0(CancellationToken cancellationToken) at Umbraco.Cms.Infrastructure.HostedServices.QueuedHostedService.BackgroundProcessing(CancellationToken stoppingToken)

Steps to reproduce

  1. Create a 'Page' document type.
  2. Create a 'Day' document type' that will be used in a block list editor. The document type should be setup as an 'element type' and the 'Allow vary by culture' should not be set.
  3. Add two date time properties of 'Opening Times' and 'Closing Times' to the 'Day' document type. The format of the date time properties should be configured as 'HH:mm'
  4. Create an 'Opening Times' Block list, composed of the 'Day' document type.
  5. On the 'Page' document type, give it the property 'Opening Times' and assign it the newly created 'Opening Hours' block list
  6. In the content section, set up the 'page' content and then add multiple 'day' elements to the block list. The times can be configured with '09:00' and '17:00'.
  7. Publish the content.
  8. Go to 'Settings', 'Examine Management', 'External Indexes', 'Rebuild Index' and check the logs for the error highlighted above.
  9. Clear the \umbraco\Data\TEMP\ExamineIndexes' and then re-start the application. Go to 'Settings', 'Examine Management', 'External Indexes' and attempt to search for the piece of content that was setup, using the content name'

Expected result / actual result

Expected: Index runs without issue and you can search for the content by name within 'Settings', 'Examine Management', 'External Index' inside of Umbraco. Actual: After a while, we sometimes get the message 'The process is taking longer than expected, check the Umbraco log to see if there have been any errors during this operation.' We can't find the content when you search for the content by name within 'Settings', 'Examine Management', 'External Index' inside of Umbraco.

github-actions[bot] commented 1 year ago

Hi there @pritesh-tailor!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

Zeegaan commented 1 year ago

Heyo! 👋 Unfortunately, I cannot reproduce this, below is an attached GIF of my setup. Is there something wrong with my setup? 🤔 RebuildingExternal

This is on 10.6.1 image

pritesh-tailor commented 1 year ago

Hi @Zeegaan ,

The language has been set to English (United Kingdom) in our Umbraco project. However, we have deployed the security patch, the odd thing is, it appears to be fine on the live and staging environments. It's just locally and on our test environment where the issue seems to still be there.

Thanks, Pritesh

pritesh-tailor commented 1 year ago

I suspect it had something to do with a corrupted database, as a clean database seems to be fine. I'll close this issue.