Sitecore ContentSearch duplicate indexes when saving items

萝らか妹 提交于 2019-12-06 07:27:41

Lucene recognises the index by its unique id which is the _uniqueid field in the <fieldNames> section

Since you're creating your own/separate indexing config, you need to have that field section added in the fieldNames section so it will recognise the index.

so it should be like

<fieldNames hint="raw:AddFieldByFieldName">
    <field fieldName="_uniqueid" storageType="YES" indexType="TOKENIZED"    
                  vectorType="NO" boost="1f" type="System.String"      
                 settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
         <analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
    </field>
    <!-- Your custom Fields -->
</fieldNames>

The problem is that you are overriding the default fieldNames configuration. You will have to include more fields in the fieldMap/fieldNames section because Sitecore needs to convert several fields to lowercase to be able to match documents correctly in lucene.

Instead of only adding your custom fields _rendering and category, copy the entire section from the DefaultIndexConfiguration and then add your custom fields.

<fieldNames hint="raw:AddFieldByFieldName">
    <fieldType fieldName="_rendering" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" type="Sitecore.SharedSource.Search.DynamicFields.RenderingField,Sitecore.SharedSource.Search" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />

    <field fieldName="category" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String"   settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />

    <!-- Fields from DefaultIndexConfiguration here -->         

</fieldNames>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!