예제 #1
0
 public AggregatedMailboxSearchTask(Guid databaseGuid, MailboxInfoList mailboxesToSearch, SearchType type, SearchCriteria criteria, PagingInfo pagingInfo, CallerInfo executingUser)
 {
     Util.ThrowOnNull(databaseGuid, "databaseGuid");
     if (databaseGuid.Equals(Guid.Empty))
     {
         throw new ArgumentNullException("databaseGuid");
     }
     Util.ThrowOnNull(mailboxesToSearch, "mailboxesToSearch");
     Util.ThrowOnNull(criteria, "criteria");
     Util.ThrowOnNull(pagingInfo, "pagingInfo");
     Util.ThrowOnNull(executingUser, "executingUser");
     if ((type & (SearchType)(-4)) != (SearchType)0 || (type & SearchType.ExpandSources) == SearchType.ExpandSources)
     {
         throw new ArgumentException("AggregatedMailboxSearchTask: the task can either be a preview task or a statistics task");
     }
     if ((type & SearchType.ExpandSources) == SearchType.ExpandSources)
     {
         throw new ArgumentException("AggregatedMailboxSearchTask: the task can either be a preview task or a statistics task");
     }
     this.mailboxesToSearch = mailboxesToSearch;
     this.mailboxDatabaseId = databaseGuid;
     this.type          = type;
     this.criteria      = criteria;
     this.pagingInfo    = pagingInfo;
     this.executingUser = executingUser;
 }
예제 #2
0
 public AggregatedMailboxSearchTask(Guid databaseGuid, MailboxInfoList mailboxesToSearch, SearchCriteria criteria, PagingInfo pagingInfo, List <string> keywordList, CallerInfo executingUser) : this(databaseGuid, mailboxesToSearch, SearchType.Statistics, criteria, pagingInfo, executingUser)
 {
     Util.ThrowOnNull(keywordList, "keywordList");
     if (keywordList.Count == 0)
     {
         throw new ArgumentException("AggregatedMailboxSearchTask: The keyword list for Stats search cannot be an empty list.");
     }
     this.keywordList = keywordList;
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, List <string> keywords, Exception exception) : this(SearchType.Statistics, false, mailboxInfoList, null, null, null, null, 0UL, ByteQuantifiedSize.Zero, null, null, exception)
 {
     Util.ThrowOnNull(keywords, "keywords");
     Util.ThrowOnNull(exception, "exception");
     this.keywordStatisticsResult = new Dictionary <string, IKeywordHit>(keywords.Count, StringComparer.InvariantCultureIgnoreCase);
     foreach (string text in keywords)
     {
         IKeywordHit keywordHit = new KeywordHit(text, this.totalResultCount, this.totalResultSize);
         foreach (MailboxInfo first in this.mailboxInfoList)
         {
             keywordHit.Errors.Add(new Pair <MailboxInfo, Exception>(first, exception));
         }
         this.keywordStatisticsResult.Add(text, keywordHit);
     }
 }
예제 #4
0
        private int CreateSearchTasks(Dictionary <Guid, List <MailboxInfo> > mailboxGroup, IEnumerable <List <string> > keywordStatsEnumerator)
        {
            int num = 0;

            foreach (Guid guid in mailboxGroup.Keys)
            {
                MailboxInfoList mailboxInfoList = Factory.Current.CreateMailboxInfoList(mailboxGroup[guid].ToArray());
                PerformanceCounters.AverageMailboxSearchedPerDatabase.IncrementBy((long)mailboxInfoList.Count);
                PerformanceCounters.AverageMailboxSearchedPerDatabaseBase.Increment();
                Factory.Current.LocalTaskTracer.TraceInformation(this.GetHashCode(), 0L, "Correlation Id:{0}. Creating {1} search task for query:{2} on mailboxes:{3} on database:{4}", new object[]
                {
                    base.ExecutingUser.QueryCorrelationId,
                    base.SearchCriteria.IsPreviewSearch ? "preview" : "statistics",
                    base.SearchCriteria.QueryString,
                    mailboxInfoList.Count,
                    guid
                });
                if (base.SearchCriteria.IsPreviewSearch)
                {
                    num++;
                    this.queue.Enqueue(Factory.Current.CreateAggregatedMailboxSearchTask(guid, mailboxInfoList, SearchType.Preview, base.SearchCriteria, base.PagingInfo, base.ExecutingUser));
                }
                if (base.SearchCriteria.IsStatisticsSearch && keywordStatsEnumerator != null)
                {
                    int num2 = 0;
                    foreach (List <string> list in keywordStatsEnumerator)
                    {
                        Factory.Current.LocalTaskTracer.TraceInformation(this.GetHashCode(), 0L, "Correlation Id:{0}. Create statistics search task batch:{1} with {2} keywords on database:{3}.", new object[]
                        {
                            base.ExecutingUser.QueryCorrelationId,
                            ++num2,
                            list.Count,
                            guid
                        });
                        num++;
                        this.queue.Enqueue(Factory.Current.CreateAggregatedMailboxSearchTask(guid, mailboxInfoList, base.SearchCriteria, base.PagingInfo, list, base.ExecutingUser));
                    }
                }
            }
            return(num);
        }
예제 #5
0
 public DiscoverySearchTaskCancelled(MailboxInfoList mailboxes, Guid databaseId) : base(Strings.SearchTaskCancelled(mailboxes.ToString(), databaseId.ToString()))
 {
 }
예제 #6
0
 public ISearchMailboxTask CreateAggregatedMailboxSearchTask(Guid databaseGuid, MailboxInfoList mailbox, SearchCriteria searchCriteria, PagingInfo pagingInfo, List <string> keywordList, CallerInfo executingUser)
 {
     return(new AggregatedMailboxSearchTask(databaseGuid, mailbox, searchCriteria, pagingInfo, keywordList, executingUser));
 }
예제 #7
0
 public ISearchMailboxTask CreateAggregatedMailboxSearchTask(Guid databaseGuid, MailboxInfoList mailbox, SearchType type, SearchCriteria searchCriteria, PagingInfo pagingInfo, CallerInfo executingUser)
 {
     return(new AggregatedMailboxSearchTask(databaseGuid, mailbox, type, searchCriteria, pagingInfo, executingUser));
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, SortedResultPage resultPage, Dictionary <string, List <IRefinerResult> > refinerResults, ulong totalResultCount, ByteQuantifiedSize totalResultSize, List <Pair <MailboxInfo, Exception> > previewFailures, List <MailboxStatistics> mailboxStatistics, IProtocolLog protocolLog) : this(SearchType.Preview, true, mailboxInfoList, resultPage, refinerResults, mailboxStatistics, protocolLog, totalResultCount, totalResultSize, previewFailures, null, null)
 {
 }
 private AggregatedSearchTaskResult(SearchType searchType, bool isSuccess, MailboxInfoList mailboxInfoList, SortedResultPage previewResultPage, Dictionary <string, List <IRefinerResult> > refinerResult, List <MailboxStatistics> mailboxStatistics, IProtocolLog protocolLog, ulong totalResultCount, ByteQuantifiedSize totalResultSize, List <Pair <MailboxInfo, Exception> > previewFailures, List <IKeywordHit> keywordStatsResults, Exception error)
 {
     Util.ThrowOnNull(mailboxInfoList, "mailboxInfoList");
     if (mailboxInfoList.Count == 0)
     {
         throw new ArgumentException("Invalid or empty mailboxInfoList");
     }
     this.resultType       = searchType;
     this.mailboxInfoList  = mailboxInfoList;
     this.success          = isSuccess;
     this.exception        = error;
     this.totalResultCount = totalResultCount;
     this.totalResultSize  = totalResultSize;
     this.protocolLog      = protocolLog;
     if (searchType == SearchType.Preview)
     {
         if (this.success)
         {
             if (totalResultCount > 0UL)
             {
                 Util.ThrowOnNull(previewResultPage, "resultPage");
             }
             if (previewResultPage != null && previewResultPage.ResultCount > 0)
             {
                 if (totalResultCount < (ulong)((long)previewResultPage.ResultCount))
                 {
                     Factory.Current.LocalTaskTracer.TraceError <string, Guid>((long)this.GetHashCode(), "The total result count was less than the current page result count for the mailbox:{0} on database:{1}", this.mailboxInfoList[0].MailboxGuid.ToString(), this.mailboxInfoList[0].MdbGuid);
                     throw new ArgumentException("The totalResultCount must be greater than or equal to the current page result count");
                 }
                 if (totalResultSize == ByteQuantifiedSize.Zero)
                 {
                     Factory.Current.LocalTaskTracer.TraceError <string, string>((long)this.GetHashCode(), "There are results from FAST but the size information was not returned from FAST for the mailbox:{0} on database:{1}", this.mailboxInfoList[0].MailboxGuid.ToString(), this.mailboxInfoList[0].MdbGuid.ToString());
                     Factory.Current.EventLog.LogEvent(InfoWorkerEventLogConstants.Tuple_DiscoveryFailedToFetchSizeInformation, null, new object[]
                     {
                         this.mailboxInfoList[0].MailboxGuid.ToString(),
                         this.mailboxInfoList[0].MdbGuid.ToString()
                     });
                 }
             }
             this.previewSearchResultPage = previewResultPage;
             this.refinersResults         = refinerResult;
             Util.ThrowOnNull(mailboxStatistics, "mailboxStatistics");
             if (this.previewSearchResultPage != null && this.previewSearchResultPage.ResultCount > 0 && mailboxStatistics.Count == 0)
             {
                 throw new ArgumentException("The MailboxStats cannot be an empty list when the results are present.");
             }
             this.mailboxStatistics = mailboxStatistics;
         }
         this.previewErrors = new List <Pair <MailboxInfo, Exception> >(this.mailboxInfoList.Count);
         if (this.exception != null)
         {
             foreach (MailboxInfo first in this.mailboxInfoList)
             {
                 this.previewErrors.Add(new Pair <MailboxInfo, Exception>(first, this.exception));
             }
         }
         if (previewFailures != null)
         {
             this.previewErrors.AddRange(previewFailures);
             return;
         }
     }
     else if (searchType == SearchType.Statistics && isSuccess)
     {
         Util.ThrowOnNull(keywordStatsResults, null);
         this.keywordStatisticsResult = new Dictionary <string, IKeywordHit>(keywordStatsResults.Count, StringComparer.InvariantCultureIgnoreCase);
         foreach (IKeywordHit keywordHit in keywordStatsResults)
         {
             IKeywordHit keywordHit2 = null;
             if (!this.keywordStatisticsResult.TryGetValue(keywordHit.Phrase, out keywordHit2))
             {
                 this.keywordStatisticsResult.Add(keywordHit.Phrase, keywordHit);
             }
         }
     }
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, List <IKeywordHit> keywordHitList) : this(mailboxInfoList, keywordHitList, 0UL, ByteQuantifiedSize.Zero)
 {
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, List <IKeywordHit> keywordHitList, ulong totalResultCount, ByteQuantifiedSize totalResultSize) : this(SearchType.Statistics, true, mailboxInfoList, null, null, null, null, totalResultCount, totalResultSize, null, keywordHitList, null)
 {
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, Exception searchError) : this(SearchType.Preview, false, mailboxInfoList, null, null, null, null, 0UL, ByteQuantifiedSize.Zero, null, null, searchError)
 {
 }
 internal AggregatedSearchTaskResult(MailboxInfoList mailboxInfoList, List <Pair <MailboxInfo, Exception> > previewFailures) : this(SearchType.Preview, false, mailboxInfoList, null, null, null, null, 0UL, ByteQuantifiedSize.Zero, previewFailures, null, null)
 {
 }