Example #1
0
 public virtual void AddItemFields()
 {
     try
     {
         VerboseLogging.CrawlingLogDebug(() => "AddItemFields start");
         if (Options.IndexAllFields)
         {
             Indexable.LoadAllFields();
         }
         if (IsParallel)
         {
             var exceptions = new ConcurrentQueue <Exception>();
             Parallel.ForEach(Indexable.Fields, ParallelOptions, f =>
             {
                 try
                 {
                     CheckAndAddField(Indexable, f);
                 }
                 catch (Exception ex)
                 {
                     exceptions.Enqueue(ex);
                 }
             });
             if (exceptions.Count > 0)
             {
                 throw new AggregateException(exceptions);
             }
         }
         else
         {
             foreach (var field in Indexable.Fields)
             {
                 CheckAndAddField(Indexable, field);
             }
         }
     }
     finally
     {
         VerboseLogging.CrawlingLogDebug(() => "AddItemFields End");
     }
 }