Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Indexing Sitecore solr索引重建和刷新之间的差异_Indexing_Solr_Sitecore_Sitecore7.2 - Fatal编程技术网

Indexing Sitecore solr索引重建和刷新之间的差异

Indexing Sitecore solr索引重建和刷新之间的差异,indexing,solr,sitecore,sitecore7.2,Indexing,Solr,Sitecore,Sitecore7.2,我们想知道Sitecore完整索引重建和索引刷新之间的区别。当我们要刷新索引中的项时,需要约2分钟。完全重建主索引需要约10分钟。为什么索引刷新如此耗时 我们正在使用以下代码刷新项目: Sitecore.Data.Item=GetItem(); var masterIndex=ContentSearchManager.GetIndex(“sitecore_master_index”); 主索引.刷新(新站点CoreIndexableItem(item)); 我正在查找Sitecore.Conte

我们想知道
Sitecore完整索引重建
索引刷新
之间的区别。当我们要刷新索引中的项时,需要约2分钟。完全重建主索引需要约10分钟。为什么索引刷新如此耗时

我们正在使用以下代码刷新项目:

Sitecore.Data.Item=GetItem();
var masterIndex=ContentSearchManager.GetIndex(“sitecore_master_index”);
主索引.刷新(新站点CoreIndexableItem(item));

我正在查找Sitecore.ContentSearch程序集的反编译源代码,看起来
Refresh
方法最终调用
indexcustomian
类上的
refreshtTree
方法。
RefreshTree
将为要索引的项创建一个新的对象数组,然后将迭代所有可用索引(即使您已从特定索引调用它),并为每个索引创建一个刷新作业(这些索引将添加到队列中以供处理):

公共静态IEnumerable刷新树(IIndexable startItem)
{
Assert.ArgumentNotNull(startItem,“startItem”);
CrawlingLog.Log.Debug(string.Format(“在{0}项上触发的indexcustomian.refreshttree”,startItem.AbsolutePath),null);
返回
从ContentSearchManager.index中的索引
选择indexcustomian.Refresh(索引,起始项);
}
公共静态作业刷新(ISearchIndex索引,IIndexable indexable)
{
Assert.ArgumentNotNull(索引,“索引”);
Assert.ArgumentNotNull(可索引,“可索引”);
object[]objArray=新对象[]{indexable};
JobOptions JobOptions=indexcustomian.GetJobOptions(索引,“刷新”,objArray,true);
jobOptions.CustomData=可索引;
CrawlingLog.Log.Debug(string.Format(“在索引{0}.Data={1}上触发的indexcustomian.Refresh”、index.Name、jobOptions.CustomData)、null);
返回JobManager.Start(作业选项);
}
FullRebuild
方法(也在
indexcustomian
中)调用
CreateRebuildJob
,该方法直接创建一个要处理的作业:

公共静态作业完整重建(ISearchIndex索引,bool start=true)
{
返回indexcustomian.CreateRebuildJob(索引,新事件处理程序(indexcustomian.RebuildStartedHandler),新事件处理程序(indexcustomian.RebuildFinishedHandler),start,null);
}
私有静态作业CreateRebuildJob(ISearchIndex索引,EventHandler startedHandler=null,EventHandler finishedHandler=null,bool start=true,object[]参数=null)
{
Assert.ArgumentNotNull(索引,“索引”);
JobOptions JobOptions=indexcustomian.GetJobOptions(索引,“重建”,参数,false);
作业=新作业(作业选项);
if(startedHandler!=null)
{
job.Started+=startedHandler;
}
如果(finishedHandler!=null)
{
job.Finished+=finishedHandler;
}
如果(启动)
{
CrawlingLog.Log.Warn(string.Format(“索引{0}触发的indexcustomian.FullRebuild.”,index.Name),null);
JobManager.Start(作业);
}
返回工作;
}

因此,
Refresh
方法通过迭代索引来增加一些开销,然后依赖于
JobManager
来排队和处理刷新作业(如果找到多个索引,则为多个)。

你说的“刷新”是什么意思?您的意思是将所选项目的新版本添加到索引中吗?如何执行此“刷新”?我已经编辑了任务,添加了代码