Azure.ContentSearch.AzureProvider.AzureIndexOperations.Add C# (CSharp) Method

Add() public method

public Add ( IIndexable indexable, IProviderUpdateContext context, ProviderIndexConfiguration indexConfiguration ) : void
indexable IIndexable
context IProviderUpdateContext
indexConfiguration ProviderIndexConfiguration
return void
        public void Add(IIndexable indexable, IProviderUpdateContext context, ProviderIndexConfiguration indexConfiguration)
        {
            Assert.ArgumentNotNull(indexable, "indexable");
            Assert.ArgumentNotNull(context, "context");
            var data = BuildDataToIndex(context, indexable);
            if (data == null)
                return;
            if (data.IsEmpty)
                CrawlingLog.Log.Warn(string.Format("AzureIndexOperations.Add(): IndexVersion produced a NULL doc for version {0}. Skipping.", indexable.UniqueId));
            var document = data.BuildDocument();

            ((IAzureProviderIndex)context.Index).AzureSchema.ReconcileAzureIndexSchema(document);

            LogIndexOperation(() => string.Format("Adding indexable UniqueId:{0}, Culture:{1}, DataSource:{2}, Index:{3}", indexable.UniqueId, indexable.Culture, indexable.DataSource, context.Index.Name), data, document);
            context.AddDocument(document, data.Culture != null ? new CultureExecutionContext(data.Culture) : null);
        }