public override bool HasNextIndexable ()
		{
			if (this.account_name == null) {
				if (!Setup ()) {
					this.queryable.RemoveGenerator (this);
					return false;
				}
			}

			if (this.tracker == null) {
				if (this.queryable.FileAttributesStore.IsUpToDate (this.CrawlFile.FullName)) {
					Logger.Log.Debug ("{0}: summary has not been updated; crawl unncessary", this.folder_name);
					this.queryable.RemoveGenerator (this);
					return false;
				}

				this.tracker = new EvolutionSummaryTracker (this.queryable.IndexDirectory, this.account_name, this.folder_name);
				this.start_crawl_time = DateTime.UtcNow;
			}

			if (this.summary == null) {
				try {
					if (this.backend_type == ImapBackendType.Imap)
						this.summary = B_U_Camel.Summary.LoadImapSummary (this.summary_info.FullName);
					else
						this.summary = B_U_Camel.Summary.LoadImap4Summary (this.summary_info.FullName);
				} catch (Exception e) {
					Logger.Log.Warn (e, "Unable to index {0}:", this.folder_name);
					this.queryable.RemoveGenerator (this);
					return false;
				}
			}

			if (this.summary_enumerator == null)
				this.summary_enumerator = this.summary.GetEnumerator ();

			if (this.summary_enumerator.MoveNext ())
				return true;

			this.delete_mode = true;
			this.deleted_list = this.tracker.GetOlderThan (this.start_crawl_time);

			if (this.deleted_list.Count > 0)
				return true;

			this.deleted_list = null;

			string progress = "";
			if (this.count > 0 && this.summary.header.count > 0) {
				progress = String.Format ("({0}/{1} {2:###.0}%)",
							  this.count,
							  this.summary.header.count,
							  100.0 * this.count / this.summary.header.count);
			}

			Logger.Log.Debug ("{0}: Finished indexing {1} messages {2}, {3} messages deleted", this.folder_name, this.indexed_count, progress, this.delete_count);

			this.tracker.Close ();
			this.tracker = null;
			this.CrawlFinished ();

			return false;
		}
예제 #2
0
        public override bool HasNextIndexable()
        {
            if (this.account_name == null)
            {
                if (!Setup())
                {
                    this.queryable.RemoveGenerator(this);
                    return(false);
                }
            }

            if (this.tracker == null)
            {
                if (this.queryable.FileAttributesStore.IsUpToDate(this.CrawlFile.FullName))
                {
                    Logger.Log.Debug("{0}: summary has not been updated; crawl unncessary", this.folder_name);
                    this.queryable.RemoveGenerator(this);
                    return(false);
                }

                this.tracker          = new EvolutionSummaryTracker(this.queryable.IndexDirectory, this.account_name, this.folder_name);
                this.start_crawl_time = DateTime.UtcNow;
            }

            if (this.summary == null)
            {
                try {
                    if (this.backend_type == ImapBackendType.Imap)
                    {
                        this.summary = B_U_Camel.Summary.LoadImapSummary(this.summary_info.FullName);
                    }
                    else
                    {
                        this.summary = B_U_Camel.Summary.LoadImap4Summary(this.summary_info.FullName);
                    }
                } catch (Exception e) {
                    Logger.Log.Warn(e, "Unable to index {0}:", this.folder_name);
                    this.queryable.RemoveGenerator(this);
                    return(false);
                }
            }

            if (this.summary_enumerator == null)
            {
                this.summary_enumerator = this.summary.GetEnumerator();
            }

            if (this.summary_enumerator.MoveNext())
            {
                return(true);
            }

            this.delete_mode  = true;
            this.deleted_list = this.tracker.GetOlderThan(this.start_crawl_time);

            if (this.deleted_list.Count > 0)
            {
                return(true);
            }

            this.deleted_list = null;

            string progress = "";

            if (this.count > 0 && this.summary.header.count > 0)
            {
                progress = String.Format("({0}/{1} {2:###.0}%)",
                                         this.count,
                                         this.summary.header.count,
                                         100.0 * this.count / this.summary.header.count);
            }

            Logger.Log.Debug("{0}: Finished indexing {1} messages {2}, {3} messages deleted", this.folder_name, this.indexed_count, progress, this.delete_count);

            this.tracker.Close();
            this.tracker = null;
            this.CrawlFinished();

            return(false);
        }