我正在试验新的Sitecore 7.2功能SwitchOnRebuildLuceneIndex
显然,此功能允许我在只读模式下访问索引,同时重建索引。
有没有办法在我重建索引的同时,有一个完整的操作索引(而不是只读索引)?
我正在执行的测试如下:
1)用30k项重建自定义索引(需要30秒)
2)同时,索引正在重建:添加一个Sitecore项(通过代码)
3)同时进行索引重建:访问自定义索引(通过代码)以获取项的计数。
4)索引完成重建后:访问自定义索引(通过代码)以获取项的计数
在步骤3中,它返回步骤4中的原始项计数30000,返回更新的项计数30001。
谢谢你的帮助
发布于 2014-07-21 14:34:33
我认为这是不可能的。从概念上讲,Sitecore本质上是一种软件,它使数据库更加用户友好,并定义了技术人员和非技术人员都可以理解和遵循的结构。您所说的与酸、数据库锁,锁和交易记录的概念背道而驰。我对您的步骤进行了更多技术性(数据库)注释,如下所示:
因此,步骤3返回新的项目计数,步骤4返回原始计数。
发布于 2014-07-23 14:31:04
如果要跟踪索引重建期间发生的更改,可以使用IntervalAsynchronousStrategy作为索引重建策略。
<strategies hint="list:AddStrategy">
<intervalAsyncMaster type="Sitecore.ContentSearch.Maintenance.Strategies.IntervalAsynchronousStrategy, Sitecore.ContentSearch">
<param desc="database">master</param>
<param desc="interval">00:00:05</param>
<!-- whether full index rebuild should be triggered if the number of items in history engine exceeds ContentSearch.FullRebuildItemCountThreshold -->
<CheckForThreshold>true</CheckForThreshold>
</intervalAsyncMaster>
</strategies>这将读取历史记录表,并相应地更新索引。如果您检查这个类的Sitecore实现,您可以看到它处理重建事件。如果重建正在运行,它什么也不做,等待下一次排定时间,如果重建已经完成,它会从History表收集条目,并将它们应用到索引中。请参见类的Run方法:
...
if (IndexCustodian.IsIndexingPaused(this.index))
{
CrawlingLog.Log.Debug(string.Format("[Index={0}] IntervalAsynchronousUpdateStrategy triggered but muted. Indexing is paused.", this.index.Name), null);
}
else if (IndexCustodian.IsRebuilding(this.index))
{
CrawlingLog.Log.Debug(string.Format("[Index={0}] IntervalAsynchronousUpdateStrategy triggered but muted. Index is being built at the moment.", this.index.Name), null);
}
else
{
CrawlingLog.Log.Debug(string.Format("[Index={0}] IntervalAsynchronousUpdateStrategy executing.", this.index.Name), null);
HistoryEntry[] history = HistoryReader.GetHistory(this.Database, this.index.Summary.LastUpdated);
...https://stackoverflow.com/questions/24862521
复制相似问题