Sitecore:索引Treelist字段时出错?

时间:2016-03-24 21:29:43

标签: sitecore sitecore8 sitecore-lucene

我在Sitecore中有一个索引。被索引的模板的一个字段是名为"标签"的树形字段。当我使用Luke检查索引时,我看到该字段并且它有值。

1。)标签索引中的值是所选列表项的ID - 我需要它作为显示名称。

2。)现在我的Crawling日志填充了:

  

WARN您已指定IncludeTemplates和ExcludeTemplates。   不支持此逻辑。排除模板将被忽略。

这就是我对索引配置所拥有的,但显然我有一些错误:

<index id="knowledge_center_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
    <param desc="name">$(id)</param>
    <param desc="folder">$(id)</param>
    <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
    <configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration">
        <include hint="list:IncludeTemplate">
            <generalTemplatePage>{AD63DB1D-A3A5-4D16-9F19-7D878BBE2568}</generalTemplatePage>
            <newsPage>{85901309-D07C-447B-97DA-EA6F1581832C}</newsPage>
            <inTheNewsPage>{C49A9219-231D-42C6-AED2-9115CC241247}</inTheNewsPage>
        </include>
        <IndexAllFields>true</IndexAllFields>
        <fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
            <fieldNames hint="raw:AddFieldByFieldName">
                <fieldType fieldName="tags" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
            </fieldNames>
        </fieldMap>
    </configuration>
    <strategies hint="list:AddStrategy">
        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/remoteRebuild" />
    </strategies>
    <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
        <policies hint="list:AddCommitPolicy">
            <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
        </policies>
    </commitPolicyExecutor>
    <locations hint="list:AddCrawler">
        <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
            <Database>web</Database>
            <Root>/sitecore/content/Sites/My Site/Knowledge Center</Root>
        </crawler>
    </locations>
</index>

更新:@Marek Musielak - 对于#1,我按照你在答案中指出的链接,在我的Crawling.logs中反复出现这种错误:

  

6272 12:49:18错误无法计算ComputedIndexField的值:   可转位的潜力:   ?Sitecore的://主/ {2D06E798-6BFE-4089-A610-5C341BF28B09}郎= EN&安培;版本= 3   例外:System.Reflection.TargetInvocationException消息:   调用的目标抛出了异常。资源:   mscorlib at System.RuntimeMethodHandle.InvokeMethod(Object target,   Object []参数,Signature sig,Boolean构造函数)at   System.Reflection.RuntimeConstructorInfo.Invoke(的BindingFlags   invokeAttr,Binder binder,Object []参数,CultureInfo文化)
  at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type,Object []   参数)at   Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode,   String []参数,布尔断言)at   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode,   String []参数,布尔断言,IFactoryHelper助手)at   Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode,   String []参数,布尔断言)at   Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode,   String []参数,Object obj,布尔断言,布尔延迟,   IFactoryHelper helper)at   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode,   String []参数,布尔断言,IFactoryHelper助手)at   Sitecore.Configuration.Factory.CreateObject(String configPath,   String []参数,布尔断言)at   Sitecore.Analytics.Reporting.ReportingQueryBase..ctor(ReportDataProviderBase   reportProvider,CachingPolicy cachingPolicy)at   Sitecore.ContentTesting.Analytics.Reporting.TestPotentialQuery..ctor(ReportDataProviderBase   reportProvider)at   Sitecore.ContentTesting.ContentSearch.ComputedIndexFields.TestPotentialMetricBase.ComputeFieldValue(IIndexable   可转位的)   Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder.AddComputedIndexFields()

     

嵌套异常

     

异常:System.Reflection.TargetInvocationException消息:   调用的目标抛出了异常。资源:   mscorlib at System.RuntimeMethodHandle.InvokeMethod(Object target,   Object []参数,Signature sig,Boolean构造函数)at   System.Reflection.RuntimeConstructorInfo.Invoke(的BindingFlags   invokeAttr,Binder binder,Object []参数,CultureInfo文化)
  at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type,Object []   参数)at   Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode,   String []参数,布尔断言)at   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode,   String []参数,布尔断言,IFactoryHelper助手)at   Sitecore.Configuration.Factory.CreateObject(String configPath,   String []参数,布尔断言)at   Sitecore.Analytics.Reports.StimulsoftIntegration.BuiltInFunctionsReportDataSource..ctor()

     

嵌套异常

     

异常:System.InvalidOperationException消息:无法使用   DataAdapterProvider as Analytics已禁用。资源:   Sitecore.Analytics.MongoDB at   Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider..ctor(Func`2   driverFactory)

为什么在Google Analytics禁用时会关注它?

更新2:@Rogier

我需要将fieldMap移动到defaultLuceneIndexConfiguration:

<defaultLuceneIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
    <fieldNames hint="raw:AddFieldByFieldName">
        <field patch:before="field[0]" fieldName="tags" storageType="YES" indexType="UNTOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
    </fieldNames>
</fieldMap>
<fields hint="raw:AddComputedIndexField">
    <field patch:before="field[0]" fieldName="tags">MyNamespace.Search.ComputedFields, MyNamespace.Search</field>
</fields>

主索引补丁最终看起来像:

<index id="knowledge_center_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
    <param desc="name">$(id)</param>
    <param desc="folder">$(id)</param>
    <!-- This initializes index property store. Id has to be set to the index id -->
    <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
    <configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration">
        <include hint="list:IncludeTemplate">
            <generalTemplatePage>{AD63DB1D-A3A5-4D16-9F19-7D878BBE2568}</generalTemplatePage>
            <newsPage>{85901309-D07C-447B-97DA-EA6F1581832C}</newsPage>
            <inTheNewsPage>{C49A9219-231D-42C6-AED2-9115CC241247}</inTheNewsPage>
        </include>
        <IndexAllFields>true</IndexAllFields>
    </configuration>
    <strategies hint="list:AddStrategy">
        <!-- NOTE: order of these is controls the execution order -->
        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" />
        <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/remoteRebuild" />
    </strategies>
    <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
        <policies hint="list:AddCommitPolicy">
            <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
        </policies>
    </commitPolicyExecutor>
    <locations hint="list:AddCrawler">
        <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
            <Database>web</Database>
            <Root>/sitecore/content/Sites/My Site/Knowledge Center</Root>
        </crawler>
    </locations>

我希望这有用......

1 个答案:

答案 0 :(得分:1)

广告1):

默认情况下,Sitecore索引所选项目的ID。原因很简单:让我们假设Sitecore存储标签的名称。想象一下,您为TagA项目选择了TagBMyArticle。 Sitecore为您的MyArticle项目编制索引,并在索引中保存TagATagB值。现在,您已将TagA重命名为Other TagA。 Sitecore不会重新抓取您的MyArticle因为它没有更改(仅标记项已更改)。因此,您的MyArticle项目的索引值不正确 - 它仍然是TagA

当然,如果您知道从不更改任何标记的名称(或显示名称),您可以轻松创建计算字段,这将保留项目显示名称。有关如何在此博客文章中执行此操作的示例:Computed index field for MultiList type field

广告2):

只需转到/sitecore/admin/showconfig.aspx页面,检查是否有任何定位ExcludeTemplate的地方。然后在App_Config\Include文件夹中跟踪该条目并瞧。