public MailData(Base.SettingsServer settings)
     : base(settings.ProfileFolder)
 {
     try {
         Settings = settings;
         ProfileSettings = new ServerProfileSettings(Settings.ProfileFolder);
         PeopleData = new PeopleData(this);
     }
     catch (System.Exception ex) {
         GenLib.Log.LogService.LogException("Error in MailData constructor: ", ex);
     }
 }
        public void InitIndexingService(string profileName)
        {
            try {
                // init the indexing service
                //resultTypeToEnum["attachmentData"] = Templates.ResultTypeEnum.attachmentData;
                resultTypeToEnum["itemData"] = Contextify.Shared.Base.Templates.ResultTypeEnum.itemData;
                resultTypeToEnum["keywordData"] = Contextify.Shared.Base.Templates.ResultTypeEnum.keywordData;
                resultTypeToEnum["peopleData"] = Contextify.Shared.Base.Templates.ResultTypeEnum.peopleData;
                resultTypeToEnum["timelineData"] = Contextify.Shared.Base.Templates.ResultTypeEnum.timelineData;

                // put initialization here
                MailData = new MailData(new SettingsServer(profileName, profileName));
                MailData.LogInfoHandler = AddEvent;
                PeopleData = MailData.PeopleData;

                AddEventAndLog("Loading profile data...");
                MailData.LoadData();
                AddEventAndLog("Profile loaded.");
                MailData.ProfileSettings.MinerUpdateNGrams = true;
                MailData.MinerUpdateSettings();

                _tagIdEmails = MailData.CreateTagIfNotExisting("Emails", "ROOT::Emails", MailData.TagIdRoot);
                _tagIdForums = MailData.CreateTagIfNotExisting("Forums", "ROOT::Forums", MailData.TagIdRoot);
                _tagIdWikis = MailData.CreateTagIfNotExisting("Wiki pages", "ROOT::Wiki pages", MailData.TagIdRoot);
                _tagIdIssues = MailData.CreateTagIfNotExisting("Issues", "ROOT::Issues", MailData.TagIdRoot);
                _tagIdIssuesMeta = MailData.CreateTagIfNotExisting("Issues meta", "ROOT::Issues meta", MailData.TagIdRoot);
                _tagIdIssuesStatus = MailData.CreateTagIfNotExisting("Issues status", "Issues meta::Issues status", _tagIdIssuesMeta);
                _tagIdIssuesResolution = MailData.CreateTagIfNotExisting("Issues resolution", "Issues meta::Issues resolution", _tagIdIssuesMeta);
                _tagIdCommits = MailData.CreateTagIfNotExisting("Source code commits", "ROOT::Source code commits", MailData.TagIdRoot);
                _tagIdAnnotationConcepts = MailData.CreateTagIfNotExisting("Annotation ontology", "ROOT::Annotation ontology", MailData.TagIdRoot);
                _tagIdSourceCode = MailData.CreateTagIfNotExisting("Information Sources ontology", "ROOT::Information Sources ontology", MailData.TagIdRoot);
                _tagIdCustomSources = MailData.CreateTagIfNotExisting("Custom sources", "ROOT::Custom sources", MailData.TagIdRoot);
                // this tag is assigned to all posts that are not issues. we need this so that we support filtering by status and resolution
                //_tagIdNonIssue = MailData.CreateTagIfNotExisting("NonIssue", "ROOT::NonIssue", MailData.TagIdRoot);

                //_tagIdIssuesStatusOpen = MailData.CreateTagIfNotExisting("Open", TagPrefixStatus + "Open", _tagIdIssuesStatus, TagMetaStatus);
                //_tagIdIssuesStatusVerified = MailData.CreateTagIfNotExisting("Verified", TagPrefixStatus + "Verified", _tagIdIssuesStatus, TagMetaStatus);
                //_tagIdIssuesStatusAssigned = MailData.CreateTagIfNotExisting("Assigned", TagPrefixStatus + "Assigned", _tagIdIssuesStatus, TagMetaStatus);
                //_tagIdIssuesStatusResolved = MailData.CreateTagIfNotExisting("Resolved", TagPrefixStatus + "Resolved", _tagIdIssuesStatus, TagMetaStatus);
                //_tagIdIssuesStatusClosed = MailData.CreateTagIfNotExisting("Closed", TagPrefixStatus + "Closed", _tagIdIssuesStatus, TagMetaStatus);

                //_tagIdIssuesResolutionNone = MailData.CreateTagIfNotExisting("None", TagPrefixStatus + "None", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionFixed = MailData.CreateTagIfNotExisting("Fixed", TagPrefixStatus + "Fixed", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionWontFix = MailData.CreateTagIfNotExisting("WontFix", TagPrefixStatus + "WontFix", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionInvalid = MailData.CreateTagIfNotExisting("", TagPrefixStatus + "", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionDuplicate = MailData.CreateTagIfNotExisting("", TagPrefixStatus + "", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionWorksForMe = MailData.CreateTagIfNotExisting("", TagPrefixStatus + "", _tagIdIssuesResolution, TagMetaResolution);
                //_tagIdIssuesResolutionUnknown = MailData.CreateTagIfNotExisting("", TagPrefixStatus + "", _tagIdIssuesResolution, TagMetaResolution);

                _so = new SourcesOntology(MailData);
                _so.AddEventHandler = AddEvent;
                AddEventAndLog("Caching source code information...");
                _so.UpdateSourcesSuggestionsDict(_tagIdSourceCode);
                AddEventAndLog("Finished.");
                AddEventAndLog("Caching people information...");
                BuildSuggestionsPersonDict();
                AddEventAndLog("Finished");
            }
            catch (Exception ex) {
                AddEvent("Failed to create the indexing service. Error message: " + ex.Message);
                GenLib.Log.LogService.LogException("Exception while initializing indexing service", ex);
            }
        }