【问题标题】:Content Search, Rebuild Index error内容搜索,重建索引错误
【发布时间】:2014-05-08 05:19:27
【问题描述】:

我是 Sitecore 的新手,我接到了使用 SiteCore 7 API 构建搜索的任务。执行搜索结果查询时出现以下错误。

System.ArgumentNullException: Value cannot be null. Parameter name:
fieldNameTranslator

以下行引发的错误

IQueryable<SearchResultItem> results = context.GetQueryable<SearchResultItem>();

堆栈说

Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter valueFormatter, IFieldQueryTranslatorMap`1 fieldQueryTranslators, FieldNameTranslator fieldNameTranslator, IExecutionContext[] executionContexts) +284

我已登录内容管理系统并在索引管理器中尝试重建 sitecore_web_index 的索引,但出现以下错误

Job started: Index_Update_IndexName=sitecore_web_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Sitecore.Exceptions.ProviderConfigurationException: Solr operations unavailable. Please check your global.asax,

【问题讨论】:

    标签: c# solr lucene sitecore sitecore7


    【解决方案1】:
    • 检查您是否可以从托管 Sitecore 应用程序的计算机访问 Solr。
    • 确保ContentSearch.Solr.ServiceBaseAddress 设置指向正确的 Solr 资源
    • 如果您的解决方案使用 IoC,请确保只为您的应用程序定义了一个 IoC 容器实例。如果需要,将容器初始化移动到 Application_Start 方法。

    【讨论】:

    • 我可以使用“localhost:8983/solr”访问 solr,我可以在下拉列表中看到“Collection1”和“itembuckets”,在配置文件中 servicebaseaddress 已经配置为使用正确和默认的 solr url,全局.asx 文件具有以下条目“"
    • 但是当我运行数据库索引时,我得到以下错误作业开始:。 Index_Update_IndexName = Sitecore_core_index | # 异常:System.Reflection.TargetInvocationException:异常已被调用的目标抛出---> Sitecore.Exceptions.PiaruobuiaiderConfigurationException:Solr 操作不可用。请检查您的 global.asax、设置和包含文件。
    • 我刚刚禁用了“Sitecore.ContentSearch.Solr.Indexes.config”,一切正常。
    • 当您将提到的 Solr 配置放入 /Include 文件夹时,您是否禁用了所有以 Sitecore.ContentSearch.Lucene 开头的 Lucene 配置?还要仔细检查您是否使用了正确版本的Sitecore.ContentSearch.SolrProvider.dllSitecore.ContentSearch.SolrProvider._&lt;IoCIntegration&gt;_.dll
    • 不知何故同时配置了 Lucene 和 Solr,但是当我将 SOLR 配置标记为禁用时,事情就开始工作了。
    【解决方案2】:

    我也面临同样的问题,在 application_start 上也配置了 IOC,但我进一步研究了这个问题,发现 Sitecore.ContentSearch.ContentSearchManager 类命中了 Factory.CreateObject( "contentSearch/configuration", true); 方法返回 Sitecore.ContentSearch.SolrProvider.SolrSearchConfiguration 对象。但预期的对象是 ProviderIndexSearchConfiguration。我使用了 solr 配置包中提供的相同 Sitecore.ContentSearch.Solr.Indexes.config

    因此,Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager 的 Initialize 方法会引发操作异常。

    public static void Initialize() { foreach (ISearchIndex searchIndex in SolrContentSearchManager.Indexes) searchIndex.Initialize(); //The searchIndex.Operations is throwing above exception when I put watch on that. }

    【讨论】:

      【解决方案3】:
      • 请确保您的 schema.xml 包含 &lt;types&gt;&lt;/types&gt; 节点,该节点应将 &lt;filedtype&gt; 节点作为其子节点。以及应将 &lt;field&gt; 节点作为其子节点的 &lt;fields&gt;&lt;/fields&gt; 节点。
      • Solr 示例文件夹中的 schema.xml 可能不包含上述节点。将上述节点添加到现有 schema.xml 后,然后从 Sitecore(控制面板->索引)生成新的 schema.xml。
      • 重新启动 Solr 实例并尝试从 Sitecore 重建索引。
      • 以上步骤为我解决了这个问题。希望对您也有帮助。

      检查this 供您参考。

      【讨论】:

        【解决方案4】:

        您可以通过在 Visual Studio 中运行以下命令从 NuGet 获取 Castle Windsor:

        Install-Package Castle.Windsor -version 3.1.0
        

        您需要在 global.asax 中设置 IOC 容器。编辑应用程序的 global.asax,如下所示,

        <%@Application Language='C#' Inherits="Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication" %>
        

        现在,问题得到解决。

        应届毕业生, 皮乌彭德拉

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2019-10-30
          • 1970-01-01
          • 1970-01-01
          • 2011-09-25
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-05-02
          相关资源
          最近更新 更多