Nil*_*Pun 1 lucene solr sitecore azure sitecore8
我们刚刚将使用 lucene 搜索提供程序的 7.2 升级到 8.1。该网站严重依赖 lucene 来搜索和索引文章,以便它可以显示为列表。
我们已经有一个 SOLR 实例设置。我们需要将此 Lucene 转换为 SOLR。如果我得到以下指导,我将不胜感激:
我们如何将自定义计算的 lucene 索引和字段转换为 Solr?
除了核心和端点的配置之外,还有哪些代码更改等需要我们注意?
索引重建事件在 SOLR 方面是如何工作的。他们(CD)是否都尝试构建一次或按顺序构建,或者只有一个触发器构建。
更新:
我切换到SOLR。我可以重建所有的 CORES 并且 web_index 显示 11K 文档。但是该页面不会返回任何结果。下面是代码片段,如果我能得到关于我做错了什么的帮助,不胜感激。这在 Lucene 中运行良好:
public IEnumerable<Article> GetArticles(Sitecore.Data.ID categoryId)
{
List<Article> articles = null;
var home = _sitecoreService.GetItem<Sitecore.Data.Items.Item>(System.Guid.Parse(ItemIds.PageIds.Home));
var index = ContentSearchManager.GetIndex(new SitecoreIndexableItem(home));
using (var context = index.CreateSearchContext(SearchSecurityOptions.DisableSecurityCheck))
{
var query = context.GetQueryable<ArticleSearchResultItem>().Filter(item => item.Category == categoryId);
var results = query.GetResults();
articles = new List<Article>();
foreach (var hit in results.Hits)
{
var article = _sitecoreService.GetItem<Article>(new Sitecore.Data.ID(hit.Document.Id).ToGuid());
if (article != null)
{
if (article.ArticlePage != null && !article.ArticlePage.HideInNavigation)
{
articles.Add(article);
}
}
}
}
return articles;
}
Run Code Online (Sandbox Code Playgroud)
计算域的实际代码可能不会改变。您需要对其进行测试以确保,但因为 Sitecore 抽象了 Lucene 和 SOLR 代码,所以只要您只是使用 Sitecore API,它就应该可以工作。您将需要更改配置。在 Lucene 索引中,您可以在defaultLuceneIndexConfiguration
节中添加计算字段。这将需要更改为defaultSolrIndexConfiguration
同样,只要您专门使用 Sitecore API 而不是直接使用 Lucene.net 或 Solr.net - 大多数代码应该可以正常工作。我发现了一些问题。
.Take()
限制的查询。Sitecore 确实为查询返回的最大行数设置了默认值,但在 SOLR 上,由于网络往返,这对查询时间的影响可能比对 Lucene 的影响大得多。IndexField
您拥有的任何属性。但有时,它可能会导致映射错误,您可能必须对此进行编码。索引重建由您的配置设置。您可以设置一些索引更新策略:
在多服务器设置中,例如:1 个内容创作服务器和 2 个内容交付服务器。您应该设置内容创作服务器或专用索引服务器来执行索引更新。交付服务器应该将所有索引的更新策略设置为手动。这会阻止每个服务器多次构建索引。
有一些关于使用 Sitecore 设置 SOLR 的好文章。供参考:* http://www.sequence.co.uk/blog/sitecore-8-and-solr/
这应该让您了解差异。
归档时间: |
|
查看次数: |
945 次 |
最近记录: |