Sitecore>逐步更新商务索引

时间:2016-12-29 14:53:44

标签: solr sitecore sitecore8 commerce

我正在尝试逐步重建Sitecore中的商业索引(所以,我不想进行完全重建)。索引策略目前设置为“手动”。

我在目录中做了一些更改(更新的关系和数据,添加/删除的产品和类别),现在只想相应地更新索引。

我尝试使用类IndexCustodian(阅读此类in the article)。但是,使用一些代码示例找不到此类的详细文档。

例如,我尝试使用IncrementalUpdate方法。作为第二个参数,我使用了一个IndexableUniqueId数组(使用uniqueid字段在搜索结果上创建),但索引尚未更改。

IEnumerable<IIndexableUniqueId> uniqueIds = foundProducts.Select(x => new IndexableUniqueId<string>(x.UniqueId));
Job job = IndexCustodian.IncrementalUpdate(ContentSearchManager.GetIndex(indexName), uniqueIds);

另一个例子,我尝试使用Refresh方法。作为第二个输入参数,我使用了为我的目录的根sitecore项创建的CommerceIndexableItem类型的对象。已添加新产品,但现有产品未完全更新:类别关系已更新,本地化字符串字段 - 尚未更新。已从索引中仍显示的目录产品中删除。

Database database = Database.GetDatabase("web");
Item rootFolder = database.GetItem(Paths.DefaultCatalogPath);
CommerceIndexableItem indexableFolder = new CommerceIndexableItem(rootFolder);
Job job = IndexCustodian.Refresh(ContentSearchManager.GetIndex(indexName), indexableFolder);

将会欣赏使用IndexCustodian的任何示例或任何其他允许更新索引的方式。

提前感谢您的帮助。

0 个答案:

没有答案