Sitecore ContentSearchManager可以';找不到索引

Sitecore ContentSearchManager可以';找不到索引,sitecore,Sitecore,我正在使用Sitecore 7.5,并尝试获取bucket item的子项。 我有一个索引“xyz”,当我尝试使用以下方法获取此索引时,它会起作用: var context = SearchManager.GetIndex("xyz").CreateSearchContext(); 但我想用这个: using (var context = ContentSearchManager.GetIndex("xyz").CreateSearchContext()) { IQueryable&l

我正在使用Sitecore 7.5,并尝试获取bucket item的子项。 我有一个索引“xyz”,当我尝试使用以下方法获取此索引时,它会起作用:

var context = SearchManager.GetIndex("xyz").CreateSearchContext();
但我想用这个:

using (var context = ContentSearchManager.GetIndex("xyz").CreateSearchContext())
{
    IQueryable<SearchResult> results = context.GetQueryable<SearchResult>();
}
使用(var context=ContentSearchManager.GetIndex(“xyz”).CreateSearchContext())
{
IQueryable results=context.GetQueryable();
}
我收到一个异常“找不到索引xyz”。为什么SearchManager找到此索引,而ContentSearchManager找不到

这是我的索引:

<configuration>
  <indexes hint="list:AddIndex">
<index id="xyz" type="Sitecore.Search.Index, Sitecore.Kernel">
      <param desc="name">$(id)</param>
      <param desc="folder">xyz</param>
      <Analyzer ref="search/analyzer" />
      <locations hint="list:AddCrawler">
        <web-pomoc type="Website.Classes.Search.BasicDatabaseCrawler, Website">
          <Database>web</Database>
          <Root>/sitecore/content/Shared/Kolekcje/Vod/Catchup-VOD</Root>
          <templates hint="list:IncludeTemplate">
            <entry>{DA757C92-A4CC-468F-BC22-AD347C8C4C9C}</entry>
          </templates>
        </web-pomoc>
      </locat
  </indexes>
</configuration>

$(id)
xyz
网状物
/sitecore/content/Shared/Kolekcje/Vod/Catchup Vod
{DA757C92-A4CC-468F-BC22-AD347C8C4C9C}
网状物
/sitecore/content/xyz/avc

现在它出现在索引管理器中,但当我重建它时,会处理0个项目。

将类型从Sitecore.Search.Index,Sitecore.Kernel更改为Sitecore.ContentSearch.LuceneProvider.LuceneIndex,Sitecore.ContentSearch.LuceneProvider

SearchManager.GetIndex(“xyz”).CreateSearchContext()-使用IndexSearchContext

ContentSearchManager.GetIndex(“xyz”).CreateSearchContext()-使用SitecoreContentSearch

Sitecore使用SitecoreContentSearch重建索引。
谢谢你的索引定义是错误的 您需要使用以下内容:

 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
  <contentSearch>
  <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
    <indexes hint="list:AddIndex">
      <index id="sitecore_web_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
        <param desc="name">$(id)</param>
        <param desc="folder">$(id)</param>
         ...
      </index>
    </indexes>
  </configuration>
</contentSearch>

$(id)
$(id)
...

请检查Sitecore 7.5中的默认索引定义

添加索引配置文件后,请检查索引是否显示在IndexManager中:


/sitecore/content/xyz/avc您在web数据库中有此项吗?您还可以检查在web数据库的根/sitecore/content/xyz/avc下是否有id为“{DA757C92-A4CC-468F-BC22-AD347C8C4C9C}”的项是,/sitecore/content/xyz/avc是一个bucket items,它包含具有此模板的项ID可能我必须配置fieldMap?当我更改为“DefaultLuceIndexConfiguration”时,它工作正常
 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
 <sitecore>
  <contentSearch>
  <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
    <indexes hint="list:AddIndex">
      <index id="sitecore_web_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
        <param desc="name">$(id)</param>
        <param desc="folder">$(id)</param>
         ...
      </index>
    </indexes>
  </configuration>
</contentSearch>