2017-06-26 83 views
2

我有一個自定義Lucene文件,我需要將其轉換爲Solr。配置文件看起來像下面提到的那個。我們如何轉換成Solr?將自定義Lucene索引配置轉換爲Sitecore中的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> 
+0

「convert into Solr」是什麼意思? Solr建立在Lucene之上 – vinod

回答

1

不久前,我看了一下默認的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的配置。在你的情況下,你只需要添加「值」作爲字符串。

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