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));
            }
        }
        public override void Delete(IIndexableId indexableId, IndexingOptions indexingOptions)
        {
            this.VerifyNotDisposed();
            if (!this.ShouldStartIndexing(indexingOptions))
            {
                return;
            }

            using (IProviderUpdateContext updateContext = this.CreateUpdateContext())
            {
                foreach (IProviderCrawler providerCrawler in this.Crawlers)
                {
                    providerCrawler.Delete(updateContext, indexableId, indexingOptions);
                }

                updateContext.Commit();
            }
        }
Ejemplo n.º 4
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));
            }
        }