我在CM和CD环境中部署我的网站,我使用solr进行搜索我按照Sitecore的所有说明从此链接配置cm环境:
当我打开cm网站时,我收到错误,说sitecore_web_index
未找到:
。他们说禁用
Sitecore.ContentSearch.Solr.Index.Web.config:
有关此错误的任何想法?我应该在CM上禁用web索引吗?
我正在使用sitecore 8.1 update 2
我正在使用此代码检索项目:
ISearchIndex SitecoreSearchIndex=ContentSearchManager.GetIndex("sitecore_" + Sitecore.Context.Database.Name + "_index");
using (var context = SitecoreSearchIndex.CreateSearchContext())
{
var culture = Sitecore.Context.Language.CultureInfo;
var predicate = PredicateBuilder.True<SearchResultItem>();
predicate = predicate.And(p => p.Paths.Contains(CommonTextFolderId));
predicate = predicate.And(p => p.TemplateId == CommonTextTemplateId);
predicate = predicate.And(p => p.Language == culture.Name);
var items = context.GetQueryable<SearchResultItem>().Where(predicate);
listCommonTexts = items.Select(p => SitecoreContext.Cast<CommonTextModel>(p.GetItem(), false, false)).ToList();
}
答案 0 :(得分:5)
使用 Solr
时,不应在内容管理服务器上禁用sitecore_web_index
。事实上,它的CM服务器应该重建所有索引。
在Content Delivery服务器上,所有索引策略都应设置为手动 - 所有CD服务器都不应重建索引。
检查此问题以解释CD和CM服务器上的Solr索引应采用何种策略:Sitecore 8.1 index rebuild strategy for SOLR search provider