Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Optimization 如何将Sitecore内容编辑器链接到为特定数据模板配置的自定义Solr搜索索引?_Optimization_Solr_Configuration_Sitecore - Fatal编程技术网

Optimization 如何将Sitecore内容编辑器链接到为特定数据模板配置的自定义Solr搜索索引?

Optimization 如何将Sitecore内容编辑器链接到为特定数据模板配置的自定义Solr搜索索引?,optimization,solr,configuration,sitecore,Optimization,Solr,Configuration,Sitecore,我已经为一个特定的数据模板创建了一个自定义的Solr搜索索引,因为我希望维护基于该模板创建的大量项目。正如您所猜测的,我将我的项目组织到Sitecore项目存储桶中以获得更好的性能,而且我还可以配置我的Sitecore前端以利用定制的Solr搜索索引。现在我想在Content Editor中优化我的项目存储桶的搜索,但Sitecore似乎将主索引置于任何自定义索引之上。如何配置Sitecore以使用自定义索引?创建自定义Solr索引后,您还应该根据Sitecore提供的示例文件之一创建相应的配置

我已经为一个特定的数据模板创建了一个自定义的Solr搜索索引,因为我希望维护基于该模板创建的大量项目。正如您所猜测的,我将我的项目组织到Sitecore项目存储桶中以获得更好的性能,而且我还可以配置我的Sitecore前端以利用定制的Solr搜索索引。现在我想在Content Editor中优化我的项目存储桶的搜索,但Sitecore似乎将主索引置于任何自定义索引之上。如何配置Sitecore以使用自定义索引?

创建自定义Solr索引后,您还应该根据Sitecore提供的示例文件之一创建相应的配置文件。例如,对于Master DB,您可以使用
Sitecore.ContentSearch.Solr.Index.Master.config.example
作为配置模板,只需在自定义索引定义中添加
patch:before=“*[1]”
属性,如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
          <index patch:before="*[1]" id="my_sitecore_custom_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" />
            </strategies>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>master</Database>
                <Root>/sitecore</Root>
              </crawler>
            </locations>
            <enableItemLanguageFallback>false</enableItemLanguageFallback>
            <enableFieldLanguageFallback>false</enableFieldLanguageFallback>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

$(id)
$(id)
主人
/站点核心
假的
假的

现在,Sitecore将加载
my\u Sitecore\u custom\u master\u index
索引配置作为第一优先级,并在处理自定义项目的任何搜索查询时使用该配置,而不是默认的Sitecore配置。

这是否仍用于优先级?在9.1中,我看到一个自定义索引被使用,尽管它是在
sitecore\u master\u index
之后修补到配置中的。实际上,我希望每次都使用
sitecore\u master\u index
的默认行为,而不管在内容编辑器中选择了什么项目。为了回答我自己的评论,下面的答案提供了一个关于如何选择索引的极好概述-