代码之家  ›  专栏  ›  技术社区  ›  Andrei

Sitecore中索引双字段时的本地化问题

  •  0
  • Andrei  · 技术社区  · 7 年前

    我对Sitecore 7.5和Lucene索引有意见。我有带有“纬度”单行文本字段的项目。此字段存储带点(非逗号)的双数。 我在我的电脑上设置了文化作为en-US,所以它应该可以处理这样的数字。我还设置了相同的IIS区域性。但当我重建索引时,我得到以下错误:

    17840 01:46:43 FATAL Could not add field {25D5A28F-F502-42CE-8FDD-C6432E64AE67} : latitude for indexable sitecore://web/{94D5DBF1-FEB9-464B-B887-A99181B58268}?lang=en&ver=1
    Exception: System.FormatException
    Message: Input string was not in a correct format.
    Source: mscorlib
    
       at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
    
       at System.String.System.IConvertible.ToDouble(IFormatProvider provider)
    
       at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    
       at Sitecore.ContentSearch.LuceneProvider.LuceneFieldBuilder.CreateField(String name, Object value, LuceneSearchFieldConfiguration fieldConfiguration, IIndexFieldStorageValueFormatter indexFieldStorageValueFormatter)
    
       at Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder.AddField(String name, Object value, LuceneSearchFieldConfiguration fieldSettings, Single boost)
    
       at Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder.AddField(IIndexableDataField field)
       at Sitecore.ContentSearch.AbstractDocumentBuilder`1.CheckAndAddField(IIndexable indexable, IIndexableDataField field)
    

    我试着调试这些方法,发现了那个系统。穿线。线当前线程。CurrentCulture是Sitecore内部的“ru ru”。内容搜索。LuceneProvider。LuceneFieldBuilder。CreateField()方法。 但在我的c代码中,我有一个系统。穿线。线当前线程。CurrentCulture设置为“en-US”。我在调试模式下检查了这个。 那么,在索引过程中,CurrentCulture怎么可能发生变化呢?我在Windows或IIS区域性设置中都没有“ru-ru”设置。

    2 回复  |  直到 7 年前
        1
  •  0
  •   Vadzim Papko    7 年前

    @几个月前,Andrei(在MS SQL中使用存储过程)也遇到了同样的问题。

    我在本地机器(Windows 10)和IIS上都将默认区域性更改为“en US”。不幸的是,这对我没有帮助。在我的例子中,我重写了存储过程,在那里我用双倍数字替换了定界符。

    所以,这是一个非常复杂的问题。我认为你应该在你的本地机器上用安装程序重新安装操作系统。

        2
  •  0
  •   Anton    7 年前

    appcmd set config /commit:WEBROOT /section:globalization /culture:en-us
    

    will set 你的文化“恩我们”。