gpt4 book ai didi

solr - 将自定义 Lucene 索引配置转换为 Sitecore 中的 Solr

转载 作者:行者123 更新时间:2023-12-04 22:43:37 25 4
gpt4 key购买 nike

我有一个自定义的 Lucene 文件,我需要将其转换为 Solr。配置文件看起来像下面提到的那个。我们如何转换成Solr?

 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>

<customMasterSearchTermConfig type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexAllFields>false</indexAllFields>
<initializeOnAdd>true</initializeOnAdd>
<analyzer ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/analyzer" />
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<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>
<!--<field fieldName="Subheading" storageType="Yes" indexType="TOKENIZED" vectorType="No" boost="if" type="System.String" settingType=""></field>-->
<field fieldName="Value" 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>-->
</fieldNames>
</fieldMap>
<include hint="list:IncludeField">
<fieldId>{B8978923-AFD2-44F4-8010-F8A0EC79F61D}</fieldId>
</include>
<fieldReaders ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldReaders" />
<indexFieldStorageValueFormatter ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexFieldStorageValueFormatter" />
<indexDocumentPropertyMapper ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/indexDocumentPropertyMapper" />
</customMasterSearchTermConfig>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>

最佳答案

不久前不得不这样做,我查看了默认的 Solr indexConfig 以找出我必须更改的内容。由于这是在不同版本的 Sitecore 上进行的,我不确定确切的差异对您来说是否相同。

不过还是比较顺利的。它主要是将类型和引用从 Lucene 更改为 Solr 变体,但请确保您还验证元素仍然相同。

最大的变化将是您的 fieldMap。在我的例子中,它变成了这样的:

<fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="..." returnType="string" />
<field fieldName="..." returnType="string" />
...
</fieldNames>
</fieldMap>

所以我引用了默认值(而不是类型),我不得不将字段定义更改为 Solr 配置。在您的情况下,您只需将“值”添加为字符串。

如前所述,您可以在默认配置中找到示例...

关于solr - 将自定义 Lucene 索引配置转换为 Sitecore 中的 Solr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44769255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com