public override void Rebuild(IndexingOptions indexingOptions)
        {
            //TODO:  Build the Azure Index
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            BuildAzureIndex();

            using (IProviderUpdateContext updateContext = CreateUpdateContext())
            {
                foreach (var crawler in this.Crawlers)
                {
                    crawler.RebuildFromRoot(updateContext, indexingOptions, CancellationToken.None);
                }

                if ((this.IndexingState & IndexingState.Stopped) != IndexingState.Stopped)
                {
                    updateContext.Optimize();
                }

                updateContext.Commit();
                updateContext.Optimize();
                stopwatch.Stop();

                if ((this.IndexingState & IndexingState.Stopped) == IndexingState.Stopped)
                {
                    return;
                }

                this.PropertyStore.Set(IndexProperties.RebuildTime, stopwatch.ElapsedMilliseconds.ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
        }
        protected override void PerformRebuild(IndexingOptions indexingOptions, CancellationToken cancellationToken)
        {
            EnsureInitialized();
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            AzureServiceClient.Indexes.Delete(this.Name);
            AzureSchema.AzureSchemaBuilt = false;

            using (IProviderUpdateContext updateContext = CreateUpdateContext())
            {
                foreach (var crawler in this.Crawlers)
                {
                    crawler.RebuildFromRoot(updateContext, indexingOptions, CancellationToken.None);
                }

                if ((this.IndexingState & IndexingState.Stopped) != IndexingState.Stopped)
                {
                    updateContext.Optimize();
                }

                updateContext.Commit();
                updateContext.Optimize();
                stopwatch.Stop();

                if ((this.IndexingState & IndexingState.Stopped) == IndexingState.Stopped)
                {
                    return;
                }

                this.PropertyStore.Set(IndexProperties.RebuildTime, stopwatch.ElapsedMilliseconds.ToString((IFormatProvider)CultureInfo.InvariantCulture));
            }
        }
Пример #3
0
        protected virtual void DoRebuild(IProviderUpdateContext context, IndexingOptions indexingOptions, CancellationToken cancellationToken)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            using (IProviderUpdateContext providerUpdateContext = this.CreateFullRebuildContext())
            {
                foreach (IProviderCrawler current in base.Crawlers)
                {
                    current.RebuildFromRoot(providerUpdateContext, indexingOptions, cancellationToken);
                }
                if ((base.IndexingState & IndexingState.Stopped) != IndexingState.Stopped)
                {
                    providerUpdateContext.Optimize();
                }
                providerUpdateContext.Commit();
            }
            stopwatch.Stop();
            if ((base.IndexingState & IndexingState.Stopped) != IndexingState.Stopped)
            {
                this.PropertyStore.Set(IndexProperties.RebuildTime, stopwatch.ElapsedMilliseconds.ToString(CultureInfo.InvariantCulture));
            }
        }