private static void LogIndexOperation(Func<string> logOperation, IndexData data, Document document) { VerboseLogging.CrawlingLogDebug(() => { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(logOperation()); stringBuilder.AppendLine(string.Format(" - UpdateTerm Field:{0}, Text:{1}", data.UpdateTerm.Name, data.UpdateTerm.Value)); if (VerboseLogging.Enabled) { foreach (var key in document.Keys) { stringBuilder.AppendLine(string.Format(" - {0}: {1}", key, document[key])); } } return stringBuilder.ToString(); }); }
internal IndexData GetIndexData(IIndexable indexable, IProviderUpdateContext context) { Assert.ArgumentNotNull(indexable, "indexable"); Assert.ArgumentNotNull(context, "context"); Assert.Required((index.Configuration.DocumentOptions as AzureDocumentBuilderOptions), "IDocumentBuilderOptions of wrong type for this crawler"); AzureDocumentBuilder documentBuilder = (AzureDocumentBuilder)ReflectionUtil.CreateObject(context.Index.Configuration.DocumentBuilderType, new object[2] { indexable, context }); if (documentBuilder == null) { CrawlingLog.Log.Error("Unable to create document builder (" + context.Index.Configuration.DocumentBuilderType + "). Please check your configuration. We will fallback to the default for now.", (Exception)null); documentBuilder = new AzureDocumentBuilder(indexable, context); } documentBuilder.AddSpecialFields(); documentBuilder.AddItemFields(); documentBuilder.AddComputedIndexFields(); documentBuilder.AddBoost(); var indexData = new IndexData(index, indexable, documentBuilder); index.AzureSchema.AddAzureIndexFields(indexData.Fields.Where(f => f.Name != indexData.UpdateTerm.Name).ToList()); index.AzureSchema.BuildAzureIndexSchema(indexData.UpdateTerm, indexData.FullUpdateTerm); return indexData; }