Sitecore 8.1更新-3;字符串未被识别为有效的日期时间。”;在管理界面中
在升级到Sitecore 8.1(我们目前正在更新-3)后的某个时候,我们开始在ELMAH中看到以下错误: 字符串未被识别为有效的日期时间 下面是完整的堆栈跟踪Sitecore 8.1更新-3;字符串未被识别为有效的日期时间。”;在管理界面中,sitecore,lucene.net,sitecore8,Sitecore,Lucene.net,Sitecore8,在升级到Sitecore 8.1(我们目前正在更新-3)后的某个时候,我们开始在ELMAH中看到以下错误: 字符串未被识别为有效的日期时间 下面是完整的堆栈跟踪 System.FormatException: Could not map index document field to property "CreatedDate" on type Sitecore.ContentSearch.SearchTypes.SitecoreUISearchResultItem : String was n
System.FormatException: Could not map index document field to property "CreatedDate" on type Sitecore.ContentSearch.SearchTypes.SitecoreUISearchResultItem : String was not recognized as a valid DateTime. ---> System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at Sitecore.ContentSearch.Converters.IndexFieldDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Sitecore.ContentSearch.Converters.IndexFieldUtcDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Sitecore.ContentSearch.Converters.IndexFieldStorageValueFormatter.ReadFromIndexStorage(Object indexValue, String fieldName, Type destinationType)
at Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(Object target, String propertyName, String documentFieldName, Object value)
--- End of inner exception stack trace ---
at Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(Object target, String propertyName, String documentFieldName, Object value)
at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapFieldValuesToType[TElement](IDictionary`2 fieldValues, TElement result, DocumentTypeMapInfo documentTypeMapInfo)
at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapToType[TElement](TDocument document, SelectMethod selectMethod, IEnumerable`1 virtualFieldProcessors, IEnumerable`1 executionContexts, SearchSecurityOptions securityOptions)
at Sitecore.ContentSearch.LuceneProvider.LuceneSearchResults`1.<GetSearchHits>d__2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at ItemBuckets.Services.Search.<ProcessRequestAsync>d__c.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
System.FormatException:无法将索引文档字段映射到类型Sitecore.ContentSearch.SearchTypes.SitecoreUISearchResultItem:字符串上的属性“CreatedDate”:未识别为有效的日期时间。-->System.FormatException:未将字符串识别为有效的日期时间。
位于System.DateTimeParse.ParseExact(字符串s、字符串格式、DateTimeFormatInfo dtfi、DateTimeStyles样式)
在Sitecore.ContentSearch.Converters.IndexFieldDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext上下文、CultureInfo区域性、对象值)
在Sitecore.ContentSearch.Converters.IndexFieldDutchDateTimeValueConverter.ConvertFrom(ITypeDescriptorContext上下文、CultureInfo区域性、对象值)
位于Sitecore.ContentSearch.Converters.IndexFieldStorageValueFormatter.ReadFromIndexStorage(对象indexValue、字符串字段名、类型destinationType)
位于Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(对象目标、字符串propertyName、字符串documentFieldName、对象值)
---内部异常堆栈跟踪的结束---
位于Sitecore.ContentSearch.DocumentTypeMapInfo.SetProperty(对象目标、字符串propertyName、字符串documentFieldName、对象值)
在Sitecore.ContentSearch.DefaultDocumentMapper`1.MapFieldValuesToType[TElement](IDictionary`2字段值,TElement结果,DocumentTypeMapInfo DocumentTypeMapInfo)
在Sitecore.ContentSearch.DefaultDocumentMapper`1.MapToType[TElement](t文档文档,SelectMethod SelectMethod,IEnumerable`1 virtualFieldProcessors,IEnumerable`1 ExecutionContext,SearchSecurityOptions securityOptions)
在Sitecore.ContentSearch.LuceneProvider.LuceneSearchResults`1.d_uu2.MoveNext()中
在System.Linq.Enumerable.WhereSelectEnumerableInterator`2.MoveNext()中
位于System.Collections.Generic.List`1..ctor(IEnumerable`1集合)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
在itemBucket.Services.Search.d_uc.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
位于System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中
在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)
通过登录Sitecore桌面并打开内容编辑器(Sitecore按钮>内容编辑器),可以复制此功能
不久前,我发现8.1的哪个实现导致了如下的补丁配置:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<!-- Override Include\Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config to work around possible bug. -->
<contentSearch>
<indexConfigurations>
<defaultLuceneIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="__smallcreateddate">
<patch:attribute name="format">yyyyMMdd</patch:attribute>
</field>
<field fieldName="__smallupdateddate">
<patch:attribute name="format">yyyyMMdd</patch:attribute>
</field>
</fieldNames>
</fieldMap>
</defaultLuceneIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
yyyyMMdd
yyyyMMdd
这是解决此问题的最佳解决方案,还是存在配置错误?能否尝试删除所有索引并重新生成所有索引。我有一个类似的问题,一些字段有一些损坏的值,如果我记得正确的话,这个补丁还有一个设置AlternateDateFormats-这允许你有多种不同的日期格式(用管道分隔)。转换器类似乎正在尝试使用此设置将字符串转换为日期。可能是Sitecore 8现在使用了不同的日期格式。不确定Sitecore 8是否取代了该修补程序,请在Sitecore.ContentSearch.LuceneProvider中反编译DateFieldReader,以查看该漏洞是否仍然存在。顺便问一下,您是否可以检查此修补程序的所有配置是否就绪?-它需要的不仅仅是2个字段声明。@IanGraham上面的补丁足以删除我们看到的错误。当你说补丁时,你是在说我链接到的网站,还是一个官方补丁?如果是后者,你能提供一个链接吗?@siteCoreclimper Done。根据Luke 3.1.0,smallcreateddate和SmallUpdateDate仍然是
yyyyymmdd
格式。