Example #1
0
        public static GetSearchableMailboxesResults GetSearchableMailboxes(ISearchPolicy policy, GetSearchableMailboxesInputs input)
        {
            Recorder.Trace(2L, TraceType.InfoTrace, "Controller.GetSearchableMailboxes Input:", input);
            Recorder.Record record   = policy.Recorder.Start("GetSearchableMailboxes", TraceType.InfoTrace, true);
            Executor        executor = new Executor(policy, typeof(InitializeGetSearchablebleMailbox))
            {
                Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency
            };
            Executor executor2 = executor;

            executor2 = executor2.Chain(new Executor(policy, typeof(DirectoryQueryFormatting))
            {
                Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency
            }).Chain(new Executor(policy, typeof(DirectoryLookup))
            {
                Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency
            }).Chain(new BatchedExecutor(policy, typeof(CompleteGetSearchableMailbox))
            {
                Concurrency     = policy.ExecutionSettings.DiscoverySynchronousConcurrency,
                BatchSize       = policy.ExecutionSettings.DiscoveryMaxAllowedExecutorItems,
                BatchKeyFactory = BatchedExecutor.BatchByCount
            });
            Recorder.Trace(2L, TraceType.InfoTrace, "Controller.GetSearchableMailboxes Start");
            GetSearchableMailboxesResults result = executor.Process(input) as GetSearchableMailboxesResults;

            policy.Recorder.End(record);
            return(result);
        }
Example #2
0
        public IEnumerable <FanoutParameters> GetServer(ISearchPolicy policy, IEnumerable <SearchSource> sources)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, "AutoDiscoveryServerProvider.GetServer Sources:", sources);
            long discoveryTimeLocal                 = 0L;
            long discoveryTimeCrossPremise          = 0L;
            IEwsEndpointDiscovery endpointDiscovery = Factory.Current.GetEwsEndpointDiscovery((from t in sources
                                                                                               select t.MailboxInfo).ToList <MailboxInfo>(), policy.RecipientSession.SessionSettings.CurrentOrganizationId, policy.CallerInfo);
            Dictionary <GroupId, List <MailboxInfo> > mailboxServerMap = endpointDiscovery.FindEwsEndpoints(out discoveryTimeLocal, out discoveryTimeCrossPremise);

            foreach (GroupId key in mailboxServerMap.Keys)
            {
                using (List <MailboxInfo> .Enumerator enumerator2 = mailboxServerMap[key].GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        MailboxInfo      mailbox          = enumerator2.Current;
                        FanoutParameters fanoutParameters = new FanoutParameters();
                        fanoutParameters.GroupId = key;
                        fanoutParameters.Source  = sources.FirstOrDefault((SearchSource t) => t.MailboxInfo == mailbox);
                        yield return(fanoutParameters);
                    }
                }
            }
            yield break;
        }
Example #3
0
        public virtual IThrottlingPolicy GetThrottlingPolicy(ISearchPolicy policy)
        {
            Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetThrottlingPolicy");
            DiscoveryTenantBudgetKey discoveryTenantBudgetKey = new DiscoveryTenantBudgetKey(policy.RecipientSession.SessionSettings.CurrentOrganizationId, BudgetType.PowerShell);

            return(discoveryTenantBudgetKey.Lookup());
        }
Example #4
0
 private void UpdateSearchStatistics(ISearchPolicy policy, Recorder.Record currentRecord, AggregatedMailboxSearchTask task)
 {
     currentRecord.Attributes["FAST"]      = (this.FastTime += task.FastTime);
     currentRecord.Attributes["STORE"]     = (this.StoreTime += task.StoreTime);
     currentRecord.Attributes["REST"]      = (this.RestrictionTime += task.RestrictionTime);
     currentRecord.Attributes["TOTALSIZE"] = (this.TotalSize += task.TotalSize);
     currentRecord.Attributes["TOTALCNT"]  = (this.TotalItems += task.TotalItems);
     currentRecord.Attributes["RTNSIZE"]   = (this.ReturnedStoreSize += task.ReturnedStoreSize);
     currentRecord.Attributes["RTNSTORE"]  = (this.ReturnedStoreItems += task.ReturnedStoreItems);
     currentRecord.Attributes["RTNFAST"]   = (this.ReturnedFastItems += task.ReturnedFastItems);
     if (task.SearchStatistics != null && task.SearchStatistics.Count > 0)
     {
         string          description = string.Format("{0}Mailboxes", currentRecord.Description);
         Recorder.Record record      = policy.Recorder.Start(description, TraceType.InfoTrace, false);
         foreach (string text in task.SearchStatistics.Keys)
         {
             Dictionary <string, string> dictionary = task.SearchStatistics[text];
             foreach (string text2 in dictionary.Keys)
             {
                 record.Attributes[string.Format("{0}-{1}", text, text2)] = dictionary[text2];
             }
         }
         policy.Recorder.End(record);
     }
 }
Example #5
0
 public ThrottlingPolicySettings(ISearchPolicy policy)
 {
     if (policy == null)
     {
         throw new ArgumentNullException("policy");
     }
     this.throttlingPolicy = SearchFactory.Current.GetThrottlingPolicy(policy);
 }
Example #6
0
 public Executor(ISearchPolicy policy, Type taskType)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "Executor.ctor Task:", taskType);
     this.defaultTimeout     = policy.ExecutionSettings.SearchTimeout;
     this.Policy             = policy;
     this.TaskType           = taskType;
     this.ExecutesInParallel = this.Policy.ExecutionSettings.DiscoveryExecutesInParallel;
     this.useRealThreads     = this.useRealThreads;
 }
Example #7
0
 public virtual ISourceConverter GetSourceConverter(ISearchPolicy policy, SourceType sourceFrom)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetSourceConverter SourceType:", sourceFrom);
     if (sourceFrom == SourceType.PublicFolder || sourceFrom == SourceType.AllPublicFolders)
     {
         return(new PublicFolderSourceConverter());
     }
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetSourceConverter No Converter SourceType:", sourceFrom);
     return(null);
 }
Example #8
0
 public ExecutionPolicySettings(ISearchPolicy policy)
 {
     if (policy == null)
     {
         throw new ArgumentNullException("policy");
     }
     this.policy      = policy;
     this.Snapshot    = SearchFactory.Current.GetVariantConfigurationSnapshot(policy);
     this.settingsMap = this.Snapshot.Discovery.GetObjectsOfType <ISettingsValue>();
     this.useRegDiscoveryUseFastSearch = this.LookupRegBool("DiscoveryUseFastSearch", out this.regDiscoveryUseFastSearch);
 }
Example #9
0
 public virtual ISearchResultProvider GetSearchResultProvider(ISearchPolicy policy, SearchType searchType)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetSearchResultProvider");
     if (searchType == SearchType.NonIndexedItemPreview || searchType == SearchType.NonIndexedItemStatistics)
     {
         return(new LocalNonIndexedResultProvider());
     }
     if (policy.ExecutionSettings.DiscoveryUseFastSearch && searchType == SearchType.Preview)
     {
         return(new FastLocalSearchResultsProvider());
     }
     return(new LocalSearchResultsProvider());
 }
Example #10
0
        public ExchangeProxy(ISearchPolicy policy, GroupId groupId)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "ExchangeProxy.ctor GroupId:",
                groupId,
                "GroupType:",
                groupId.GroupType,
                "Uri:",
                groupId.Uri
            });
            this.groupId = groupId;
            this.policy  = policy;
            ExchangeCredentials credentials;

            if (this.groupId.GroupType == GroupType.CrossPremise)
            {
                credentials = new OAuthCredentials(OAuthCredentials.GetOAuthCredentialsForAppToken(this.policy.CallerInfo.OrganizationId, groupId.Domain));
            }
            else
            {
                credentials = new WebCredentials();
            }
            string text = string.Format("{0}&FOUT=true", policy.CallerInfo.UserAgent);

            this.InitializeExchangeProxy(credentials, groupId.Uri, (long)groupId.ServerVersion);
            this.exchangeService.HttpHeaders[CertificateValidationManager.ComponentIdHeaderName] = typeof(IEwsClient).FullName;
            this.exchangeService.ClientRequestId = this.policy.CallerInfo.QueryCorrelationId.ToString();
            this.exchangeService.Timeout         = (int)TimeSpan.FromMinutes(this.policy.ThrottlingSettings.DiscoverySearchTimeoutPeriod).TotalMilliseconds;
            if (this.groupId.GroupType == GroupType.CrossPremise)
            {
                this.exchangeService.UserAgent       = text;
                this.exchangeService.ManagementRoles = new ManagementRoles(null, ExchangeProxy.mailboxSearchApplicationRole);
                return;
            }
            this.exchangeService.UserAgent = WellKnownUserAgent.GetEwsNegoAuthUserAgent(string.Format("{0}-{1}", ExchangeProxy.crossServerUserAgent, text));
            if (this.policy.CallerInfo.CommonAccessToken != null && !this.policy.CallerInfo.IsOpenAsAdmin)
            {
                this.exchangeService.HttpHeaders["X-CommonAccessToken"] = this.policy.CallerInfo.CommonAccessToken.Serialize();
                if (this.policy.CallerInfo.UserRoles != null || this.policy.CallerInfo.ApplicationRoles != null)
                {
                    this.exchangeService.ManagementRoles = new ManagementRoles(this.policy.CallerInfo.UserRoles, this.policy.CallerInfo.ApplicationRoles);
                }
            }
        }
Example #11
0
        public virtual VariantConfigurationSnapshot GetVariantConfigurationSnapshot(ISearchPolicy policy)
        {
            Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetVariantConfigurationSnapshot");
            VariantConfigurationSnapshot variantConfigurationSnapshot = null;

            if (policy.RunspaceConfiguration != null && policy.RunspaceConfiguration.ExecutingUser != null)
            {
                Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetVariantConfigurationSnapshot Loading User Snapshpt");
                ADUser user = new ADUser(policy.RecipientSession, policy.RunspaceConfiguration.ExecutingUser.propertyBag);
                variantConfigurationSnapshot = VariantConfiguration.GetSnapshot(user.GetContext(null), null, null);
            }
            if (variantConfigurationSnapshot == null)
            {
                Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetVariantConfigurationSnapshot User Snapshot Failed, Loading Global Snapshot");
                variantConfigurationSnapshot = VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null);
            }
            return(variantConfigurationSnapshot);
        }
Example #12
0
        private IEnumerable <List <string> > GenerateKeywordStatsQueryBatches(ISearchPolicy policy, ResultAggregator aggregator, SearchCriteria criteria)
        {
            List <string> list = new List <string>
            {
                criteria.QueryString
            };

            aggregator.KeywordStatistics.Add(criteria.QueryString, new KeywordHit(criteria.QueryString, 0UL, ByteQuantifiedSize.Zero));
            if (criteria.SubFilters != null)
            {
                foreach (string text in criteria.SubFilters.Keys)
                {
                    aggregator.KeywordStatistics.Add(text, new KeywordHit(text, 0UL, ByteQuantifiedSize.Zero));
                }
                list.AddRange(criteria.SubFilters.Keys);
            }
            return(Util.PartitionInSetsOf <string>(list, 5));
        }
        public void ApplyConfiguration(ISearchPolicy policy, ref SearchMailboxesInputs inputs)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Inputs:", inputs);
            if (inputs.Sources != null && inputs.Sources.Count > 0 && inputs.Sources[0].SourceType == SourceType.SavedSearchId)
            {
                inputs.SearchConfigurationId = inputs.Sources[0].ReferenceId;
                inputs.Sources.RemoveAt(0);
                Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Found In Sources SearchId:", inputs.SearchConfigurationId);
            }
            if (!string.IsNullOrWhiteSpace(inputs.SearchConfigurationId))
            {
                Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Found SearchId:", inputs.SearchConfigurationId);
                IDiscoverySearchDataProvider discoverySearchDataProvider = new DiscoverySearchDataProvider(policy.RecipientSession.SessionSettings.CurrentOrganizationId);
                MailboxDiscoverySearch       mailboxDiscoverySearch      = discoverySearchDataProvider.Find <MailboxDiscoverySearch>(inputs.SearchConfigurationId);
                if (mailboxDiscoverySearch == null)
                {
                    Recorder.Trace(5L, TraceType.ErrorTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Invalid SearchId:", inputs.SearchConfigurationId);
                    throw new SearchException(KnownError.ErrorInvalidSearchId);
                }
                inputs.SearchQuery = mailboxDiscoverySearch.CalculatedQuery;
                inputs.Language    = mailboxDiscoverySearch.Language;
                Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                {
                    "ArbitrationSearchConfigurationProvider.ApplyConfiguration Query:",
                    inputs.SearchQuery,
                    "Language:",
                    inputs.Language
                });
                if (inputs.Sources == null || inputs.Sources.Count == 0)
                {
                    Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration No Sources");
                    inputs.Sources = new List <SearchSource>();
                    if (mailboxDiscoverySearch.Sources != null && mailboxDiscoverySearch.Sources.Count > 0)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Mailboxes:", mailboxDiscoverySearch.Sources.Count);
                        using (MultiValuedProperty <string> .Enumerator enumerator = mailboxDiscoverySearch.Sources.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string referenceId = enumerator.Current;
                                inputs.Sources.Add(new SearchSource
                                {
                                    ReferenceId    = referenceId,
                                    SourceLocation = SourceLocation.All,
                                    SourceType     = SourceType.AutoDetect
                                });
                            }
                            goto IL_234;
                        }
                    }
                    if (mailboxDiscoverySearch.Version == SearchObjectVersion.Original || mailboxDiscoverySearch.AllSourceMailboxes)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration AllMailboxes");
                        inputs.Sources.Add(new SearchSource
                        {
                            SourceLocation = SourceLocation.All,
                            SourceType     = SourceType.AllMailboxes
                        });
                    }
IL_234:
                    if (mailboxDiscoverySearch.PublicFolderSources != null && mailboxDiscoverySearch.PublicFolderSources.Count > 0)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration PublicFoiders:", mailboxDiscoverySearch.PublicFolderSources.Count);
                        using (MultiValuedProperty <string> .Enumerator enumerator2 = mailboxDiscoverySearch.PublicFolderSources.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                string referenceId2 = enumerator2.Current;
                                inputs.Sources.Add(new SearchSource
                                {
                                    ReferenceId    = referenceId2,
                                    SourceLocation = SourceLocation.All,
                                    SourceType     = SourceType.PublicFolder
                                });
                            }
                            return;
                        }
                    }
                    if (mailboxDiscoverySearch.AllPublicFolderSources)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration AllPublicFoiders");
                        inputs.Sources.Add(new SearchSource
                        {
                            SourceLocation = SourceLocation.PrimaryOnly,
                            SourceType     = SourceType.AllPublicFolders
                        });
                    }
                }
            }
        }
Example #14
0
 public virtual IConfigurationSession GetConfigurationSession(ISearchPolicy policy)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetConfigurationSession");
     return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, policy.RecipientSession.SessionSettings, 222, "GetConfigurationSession", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\MailboxSearch\\WebService\\Infrastructure\\SearchFactory.cs"));
 }
Example #15
0
        public static SearchMailboxesResults SeachMailboxes(ISearchPolicy policy, SearchMailboxesInputs input)
        {
            Recorder.Trace(2L, TraceType.InfoTrace, new object[]
            {
                "Controller.SeachMailboxes Input:",
                input,
                "IsLocal:",
                input.IsLocalCall,
                "SearchType:",
                input.SearchType
            });
            Recorder.Record record = policy.Recorder.Start("SearchMailboxes", TraceType.InfoTrace, true);
            ValidateSource.ValidateSourceContext taskContext = new ValidateSource.ValidateSourceContext
            {
                AllowedRecipientTypeDetails = SearchRecipient.RecipientTypeDetail,
                AllowedRecipientTypes       = SearchRecipient.RecipientTypes,
                MinimumVersion           = null,
                RequiredCmdlet           = "New-MailboxSearch",
                RequiredCmdletParameters = "EstimateOnly"
            };
            MailboxInfoCreation.MailboxInfoCreationContext taskContext2 = new MailboxInfoCreation.MailboxInfoCreationContext
            {
                SuppressDuplicates = true,
                MaximumItems       = (int)((input != null && input.SearchType == SearchType.Statistics) ? policy.ThrottlingSettings.DiscoveryMaxStatsSearchMailboxes : ((uint)policy.ExecutionSettings.DiscoveryMaxMailboxes))
            };
            ServerLookup.ServerLookupContext taskContext3 = new ServerLookup.ServerLookupContext();
            CompleteSearchMailbox.CompleteSearchMailboxContext taskContext4 = new CompleteSearchMailbox.CompleteSearchMailboxContext();
            Func <object, string> batchByDatabase = delegate(object item)
            {
                if (!((SearchSource)item).MailboxInfo.IsArchive)
                {
                    return(((SearchSource)item).MailboxInfo.MdbGuid.ToString());
                }
                return(((SearchSource)item).MailboxInfo.ArchiveDatabase.ToString());
            };
            Func <object, string> batchKeyFactory = delegate(object item)
            {
                if (!((SearchSource)item).MailboxInfo.IsRemoteMailbox)
                {
                    return(batchByDatabase(item));
                }
                return("Remote");
            };
            Func <object, string> batchKeyFactory2 = (object item) => ((FanoutParameters)item).GroupId.Uri.ToString();
            Executor executor = new Executor(policy, typeof(InitializeSearchMailbox))
            {
                Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency
            };
            Executor executor2 = executor;

            if (input.IsLocalCall)
            {
                Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes LocalSearch");
                executor2 = executor2.Chain(new BatchedExecutor(policy, typeof(SearchDatabase))
                {
                    Concurrency     = policy.ExecutionSettings.DiscoveryLocalSearchConcurrency,
                    BatchSize       = (policy.ExecutionSettings.DiscoveryLocalSearchIsParallel ? 1U : policy.ExecutionSettings.DiscoveryLocalSearchBatch),
                    BatchKeyFactory = batchByDatabase
                });
            }
            else
            {
                Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes Search");
                executor2 = executor2.Chain(new Executor(policy, typeof(DirectoryQueryFormatting))
                {
                    Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency
                }).Chain(new Executor(policy, typeof(DirectoryLookup))
                {
                    Concurrency = policy.ExecutionSettings.DiscoveryADLookupConcurrency
                }).Chain(new Executor(policy, typeof(ValidateSource))
                {
                    Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency,
                    TaskContext = taskContext
                }).Chain(new Executor(policy, typeof(MailboxInfoCreation))
                {
                    Concurrency = policy.ExecutionSettings.DiscoverySynchronousConcurrency,
                    TaskContext = taskContext2
                });
                if (input.SearchType == SearchType.ExpandSources)
                {
                    Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes ExpandSources");
                    executor2 = executor2.Chain(new BatchedExecutor(policy, typeof(CompleteSourceLookup))
                    {
                        Concurrency     = policy.ExecutionSettings.DiscoverySynchronousConcurrency,
                        BatchKeyFactory = BatchedExecutor.BatchByCount,
                        BatchSize       = policy.ThrottlingSettings.DiscoveryMaxPreviewSearchMailboxes,
                        TaskContext     = input
                    });
                }
                else
                {
                    executor2 = executor2.Chain(new BatchedExecutor(policy, typeof(ServerLookup))
                    {
                        Concurrency     = policy.ExecutionSettings.DiscoveryServerLookupConcurrency,
                        TaskContext     = taskContext3,
                        BatchSize       = policy.ExecutionSettings.DiscoveryServerLookupBatch,
                        BatchKeyFactory = batchKeyFactory
                    }).Chain(new BatchedExecutor(policy, typeof(FanoutSearchMailboxes))
                    {
                        Concurrency     = policy.ExecutionSettings.DiscoveryFanoutConcurrency,
                        BatchSize       = policy.ExecutionSettings.DiscoveryFanoutBatch,
                        BatchKeyFactory = batchKeyFactory2
                    });
                }
            }
            executor2 = executor2.Chain(new Executor(policy, typeof(CompleteSearchMailbox))
            {
                Concurrency = 1U,
                TaskContext = taskContext4
            });
            Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes Start");
            SearchMailboxesResults result;

            try
            {
                ServicePointManager.ServerCertificateValidationCallback = (RemoteCertificateValidationCallback)Delegate.Combine(ServicePointManager.ServerCertificateValidationCallback, new RemoteCertificateValidationCallback(ServerToServerEwsCallingContext.CertificateErrorHandler));
                SearchMailboxesResults searchMailboxesResults = executor.Process(input) as SearchMailboxesResults;
                Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes End");
                if (executor.Context.Failures.Count > 0)
                {
                    Recorder.Trace(2L, TraceType.InfoTrace, "Controller.SeachMailboxes Failures:", executor.Context.Failures.Count);
                    if (searchMailboxesResults == null)
                    {
                        searchMailboxesResults = new SearchMailboxesResults(null);
                    }
                    searchMailboxesResults.AddFailures(executor.Context.Failures);
                }
                policy.Recorder.End(record);
                result = searchMailboxesResults;
            }
            finally
            {
                ServicePointManager.ServerCertificateValidationCallback = (RemoteCertificateValidationCallback)Delegate.Remove(ServicePointManager.ServerCertificateValidationCallback, new RemoteCertificateValidationCallback(ServerToServerEwsCallingContext.CertificateErrorHandler));
            }
            return(result);
        }
        public IEnumerable <SearchRecipient> Query(ISearchPolicy policy, DirectoryQueryParameters request)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "ActiveDirectoryProvider.Query Query:",
                request.Query,
                "PageSize:",
                request.PageSize,
                "Properties:",
                request.Properties,
                "ExpandGroups:",
                request.ExpandGroups
            });
            ADPagedReader <ADRawEntry> pagedReader = policy.RecipientSession.FindPagedADRawEntry(null, QueryScope.SubTree, request.Query, null, request.PageSize, request.Properties);

            new List <SearchRecipient>();
            foreach (ADRawEntry entry in pagedReader)
            {
                if (request.ExpandGroups && SearchRecipient.IsMembershipGroup(entry))
                {
                    Recorder.Trace(5L, TraceType.InfoTrace, "ActiveDirectoryProvider.Query Expanding:", entry);
                    List <ADRawEntry>    groupEntries = new List <ADRawEntry>();
                    ADRecipientExpansion expansion    = new ADRecipientExpansion(policy.RecipientSession, false, request.Properties);
                    ADRecipientExpansion.HandleRecipientDelegate handleDelegate = delegate(ADRawEntry recipient, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentExpansionType)
                    {
                        if (recipientExpansionType == ExpansionType.GroupMembership)
                        {
                            return(ExpansionControl.Continue);
                        }
                        groupEntries.Add(recipient);
                        return(ExpansionControl.Skip);
                    };
                    ADRecipientExpansion.HandleFailureDelegate failureDelegate = delegate(ExpansionFailure expansionFailure, ADRawEntry recipient, ExpansionType recipientExpansionType, ADRawEntry parent, ExpansionType parentExpansionType)
                    {
                        Recorder.Trace(5L, TraceType.ErrorTrace, new object[]
                        {
                            "ActiveDirectoryProvider.Query Expansion Failed:",
                            recipient,
                            "Error:",
                            expansionFailure,
                            "ExpansionType:",
                            recipientExpansionType,
                            "Parent:",
                            parent,
                            "ParentyExpansionType:",
                            parentExpansionType
                        });
                        return(ExpansionControl.Skip);
                    };
                    expansion.Expand(entry, handleDelegate, failureDelegate);
                    foreach (ADRawEntry groupEntry in groupEntries)
                    {
                        yield return(new SearchRecipient(groupEntry, entry));
                    }
                }
                else
                {
                    yield return(new SearchRecipient(entry, null));
                }
            }
            yield break;
        }
Example #17
0
        public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input)
        {
            long                     num        = 0L;
            long                     num2       = 0L;
            long                     num3       = 0L;
            long                     num4       = 0L;
            long                     num5       = 0L;
            long                     num6       = 0L;
            ulong                    num7       = 0UL;
            SortedResultPage         resultPage = null;
            MultiMailboxSearchClient multiMailboxSearchClient = null;
            ResultAggregator         resultAggregator         = new ResultAggregator();
            ByteQuantifiedSize       byteQuantifiedSize       = new ByteQuantifiedSize(0UL);
            List <MailboxStatistics> list = new List <MailboxStatistics>();
            Dictionary <Guid, List <KeyValuePair <int, long> > > dictionary = new Dictionary <Guid, List <KeyValuePair <int, long> > >();
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Recorder.Record record = policy.Recorder.Start("SearchResultProvider", TraceType.InfoTrace, true);
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "FastLocalSearchResultsProvider.Search Input:",
                input,
                "Type:",
                input.SearchType
            });
            SearchMailboxesResults result;

            try
            {
                Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Initializing");
                num3 = stopwatch.ElapsedMilliseconds;
                string str  = (input.PagingInfo != null && input.PagingInfo.SortBy != null && input.PagingInfo.SortBy.SortOrder == SortOrder.Ascending) ? "+" : "-";
                string str2 = (input.PagingInfo != null && input.PagingInfo.SortValue != null && input.PagingInfo.SortValue.SortColumn == ItemSchema.DocumentId) ? "[docid]" : FastIndexSystemSchema.Received.Name;
                AdditionalParameters additionalParameters = new AdditionalParameters
                {
                    Sort     = str + str2,
                    Refiners = new string[]
                    {
                        FastIndexSystemSchema.Size.Name
                    }
                };
                long referenceDocId = 0L;
                PaginationQueryFilter pagingFilter = null;
                QueryFilter           queryFilter  = input.Criteria.Query;
                if (input.PagingInfo != null && input.PagingInfo.SortValue != null)
                {
                    referenceDocId = input.PagingInfo.SortValue.SecondarySortValue;
                    if (input.PagingInfo.SortValue.SortColumnValue != null && input.PagingInfo.SortValue.SortColumn != ItemSchema.DocumentId)
                    {
                        pagingFilter = new PaginationQueryFilter(input.PagingInfo);
                    }
                }
                SearchSource searchSource = input.Sources.FirstOrDefault <SearchSource>();
                if (searchSource != null)
                {
                    Guid   guid        = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid;
                    string displayName = FlowDescriptor.GetImsFlowDescriptor(FastLocalSearchResultsProvider.SearchConfig, FastIndexVersion.GetIndexSystemName(guid)).DisplayName;
                    num4 += stopwatch.ElapsedMilliseconds - num3;
                    num3  = stopwatch.ElapsedMilliseconds;
                    Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                    {
                        "FastLocalSearchResultsProvider.Search Initialized DB:",
                        guid,
                        "Flow:",
                        displayName
                    });
                    List <SearchSource> list2 = new List <SearchSource>(input.Sources);
                    while (list2.Count > 0)
                    {
                        HashSet <Guid>      hashSet = new HashSet <Guid>();
                        List <SearchSource> list3   = new List <SearchSource>();
                        int i = 0;
                        while (i < list2.Count)
                        {
                            SearchSource searchSource2 = list2[i];
                            Guid         item          = searchSource2.MailboxInfo.IsArchive ? searchSource2.MailboxInfo.ArchiveGuid : searchSource2.MailboxInfo.MailboxGuid;
                            if (!hashSet.Contains(item))
                            {
                                list3.Add(searchSource2);
                                list2.RemoveAt(i);
                                hashSet.Add(item);
                            }
                            else
                            {
                                i++;
                            }
                        }
                        multiMailboxSearchClient = new MultiMailboxSearchClient(guid, (from s in list3
                                                                                       select s.MailboxInfo).ToArray <MailboxInfo>(), input.Criteria, input.CallerInfo, input.PagingInfo);
                        foreach (SearchSource searchSource3 in list3)
                        {
                            Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Searching Source", searchSource3);
                            ulong              num8 = 0UL;
                            bool               flag = false;
                            MailboxStatistics  mailboxStatistics   = null;
                            ByteQuantifiedSize byteQuantifiedSize2 = new ByteQuantifiedSize(0UL);
                            List <KeyValuePair <int, long> > list4 = new List <KeyValuePair <int, long> >();
                            Guid guid2 = searchSource3.MailboxInfo.IsArchive ? searchSource3.MailboxInfo.ArchiveGuid : searchSource3.MailboxInfo.MailboxGuid;
                            queryFilter = this.ApplyFolderFilter(queryFilter, searchSource3.MailboxInfo, multiMailboxSearchClient);
                            string text = FqlQueryBuilder.ToFqlString(queryFilter, input.Criteria.QueryCulture);
                            text = this.ApplyPagingFilter(text, referenceDocId, pagingFilter, input.PagingInfo, input.Criteria.QueryCulture);
                            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                            {
                                "FastLocalSearchResultsProvider.Search Searching Source Guid:",
                                guid2,
                                "Filter:",
                                queryFilter,
                                "Query:",
                                text
                            });
                            num6 += stopwatch.ElapsedMilliseconds - num3;
                            num3  = stopwatch.ElapsedMilliseconds;
                            IEnumerable <KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> > enumerable = FastLocalSearchResultsProvider.FlowExecutor.Execute(displayName, guid2, policy.CallerInfo.QueryCorrelationId, text, 0L, input.Criteria.QueryCulture, additionalParameters, Math.Min(FastLocalSearchResultsProvider.SearchConfig.FastQueryResultTrimHits, input.PagingInfo.PageSize), null);
                            foreach (KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> keyValuePair in enumerable)
                            {
                                Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found pages");
                                PagingImsFlowExecutor.QueryExecutionContext key = keyValuePair.Key;
                                ISearchResultItem[] value = keyValuePair.Value;
                                if (!flag)
                                {
                                    Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found statistics");
                                    num8 += (ulong)FastLocalSearchResultsProvider.FlowExecutor.ReadHitCount(key);
                                    IEnumerable <RefinerResult> source = FastLocalSearchResultsProvider.FlowExecutor.ReadRefiners(key);
                                    RefinerResult refinerResult        = source.FirstOrDefault((RefinerResult t) => t.Name == FastIndexSystemSchema.Size.Name);
                                    if (refinerResult != null)
                                    {
                                        byteQuantifiedSize2 += new ByteQuantifiedSize((ulong)refinerResult.Sum);
                                    }
                                    mailboxStatistics = new MailboxStatistics(searchSource3.MailboxInfo, num8, byteQuantifiedSize2);
                                    flag = true;
                                }
                                foreach (ISearchResultItem searchResultItem in value)
                                {
                                    Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found items");
                                    IFieldHolder fieldHolder = searchResultItem.Fields.FirstOrDefault((IFieldHolder f) => string.Equals(f.Name, "DocId", StringComparison.InvariantCultureIgnoreCase));
                                    if (fieldHolder != null)
                                    {
                                        long num9       = (long)fieldHolder.Value;
                                        int  documentId = IndexId.GetDocumentId(num9);
                                        IndexId.GetMailboxNumber(num9);
                                        list4.Add(new KeyValuePair <int, long>(documentId, num9));
                                    }
                                }
                                if (list4.Count >= input.PagingInfo.PageSize)
                                {
                                    Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search completed FAST");
                                    break;
                                }
                            }
                            num7 += num8;
                            byteQuantifiedSize += byteQuantifiedSize2;
                            if (list4.Count > 0)
                            {
                                dictionary[guid2] = list4;
                            }
                            if (mailboxStatistics != null)
                            {
                                list.Add(mailboxStatistics);
                            }
                            num += stopwatch.ElapsedMilliseconds - num3;
                            num3 = stopwatch.ElapsedMilliseconds;
                        }
                        if (dictionary.Count > 0)
                        {
                            Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search loading preview items");
                            resultPage = multiMailboxSearchClient.FetchPreviewProperties(dictionary);
                            num2      += stopwatch.ElapsedMilliseconds - num3;
                            num3       = stopwatch.ElapsedMilliseconds;
                        }
                        Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search aggregating");
                        ISearchResult aggregator = new AggregatedSearchTaskResult(new MailboxInfoList(multiMailboxSearchClient.Mailboxes), resultPage, null, num7, byteQuantifiedSize, null, list, null);
                        resultAggregator.MergeSearchResult(aggregator);
                        num5 += stopwatch.ElapsedMilliseconds - num3;
                        num3  = stopwatch.ElapsedMilliseconds;
                    }
                }
                result = new SearchMailboxesResults(input.Sources)
                {
                    SearchResult = resultAggregator
                };
            }
            finally
            {
                record.Attributes["FAST"]      = num;
                record.Attributes["STORE"]     = num2;
                record.Attributes["REST"]      = num6;
                record.Attributes["INIT"]      = num4;
                record.Attributes["AGGR"]      = num5;
                record.Attributes["TOTALSIZE"] = byteQuantifiedSize;
                record.Attributes["TOTALCNT"]  = num7;
                policy.Recorder.End(record);
            }
            return(result);
        }
Example #18
0
 public BatchedExecutor(ISearchPolicy policy, Type taskType) : base(policy, taskType)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "BatchedExecutor.ctor Task:", taskType);
     this.BatchSize       = policy.ExecutionSettings.DiscoveryMaxAllowedExecutorItems;
     this.BatchKeyFactory = BatchedExecutor.BatchByCount;
 }
        public IEnumerable <SearchSource> Convert(ISearchPolicy policy, IEnumerable <SearchSource> sources)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert Sources:", sources);
            IConfigurationSession configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, policy.RecipientSession.SessionSettings, 46, "Convert", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\MailboxSearch\\WebService\\External\\PublicFolderSourceConverter.cs");

            using (PublicFolderDataProvider provider = new PublicFolderDataProvider(configurationSession, "Get-PublicFolder", Guid.Empty))
            {
                foreach (SearchSource source in sources)
                {
                    if (source.SourceType == SourceType.PublicFolder)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                        {
                            "PublicFolderSourceConverter.Convert Source:",
                            source.ReferenceId,
                            "PublicFolderSourceConverter.Type:",
                            source.SourceType
                        });
                        PublicFolder publicFolder = null;
                        try
                        {
                            PublicFolderId publicFolderId2;
                            if (this.IsPath(source.ReferenceId))
                            {
                                Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert From Path:", source.ReferenceId);
                                publicFolderId2 = new PublicFolderId(new MapiFolderPath(source.ReferenceId));
                            }
                            else
                            {
                                Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert From StoreId:", source.ReferenceId);
                                StoreObjectId storeObjectId = StoreObjectId.FromHexEntryId(source.ReferenceId);
                                publicFolderId2 = new PublicFolderId(storeObjectId);
                            }
                            if (publicFolderId2 != null)
                            {
                                Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert PublicFolderId:", publicFolderId2);
                                publicFolder = (PublicFolder)provider.Read <PublicFolder>(publicFolderId2);
                            }
                        }
                        catch (FormatException)
                        {
                            Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert FormatException, Source:", source);
                        }
                        if (publicFolder != null)
                        {
                            yield return(this.GetSource(source, publicFolder));
                        }
                        else
                        {
                            Recorder.Trace(5L, TraceType.InfoTrace, "PublicFolderSourceConverter.Convert Failed, Source:", source);
                            yield return(source);
                        }
                    }
                    else if (source.SourceType == SourceType.AllPublicFolders)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                        {
                            "PublicFolderSourceConverter.Convert Source:",
                            source.ReferenceId,
                            "Type:",
                            source.SourceType
                        });
                        PublicFolderId             publicFolderId = new PublicFolderId(MapiFolderPath.IpmSubtreeRoot);
                        IEnumerable <PublicFolder> folders        = provider.FindPaged <PublicFolder>(null, publicFolderId, true, null, 50);
                        foreach (PublicFolder publicFolder2 in folders)
                        {
                            if (publicFolder2.FolderPath != MapiFolderPath.IpmSubtreeRoot)
                            {
                                yield return(this.GetSource(source, publicFolder2));
                            }
                        }
                    }
                }
            }
            yield break;
        }
Example #20
0
 public virtual ISearchConfigurationProvider GetSearchConfigurationProvider(ISearchPolicy policy)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetSearchConfigurationProvider");
     return(new ArbitrationSearchConfigurationProvider());
 }
Example #21
0
 public virtual IDirectoryProvider GetDirectoryProvider(ISearchPolicy policy)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetDirectoryProvider");
     return(new ActiveDirectoryProvider());
 }
Example #22
0
 public virtual IServerProvider GetServerProvider(ISearchPolicy policy)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetServerProvider");
     return(new AutoDiscoveryServerProvider());
 }
Example #23
0
        public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input)
        {
            Guid databaseGuid = Guid.Empty;
            List <SearchSource>          list       = new List <SearchSource>(input.Sources);
            ResultAggregator             aggregator = new ResultAggregator();
            IEnumerable <List <string> > enumerable = null;

            Recorder.Record record = policy.Recorder.Start("SearchResultProvider", TraceType.InfoTrace, true);
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "LocalSearchResultsProvider.Search Input:",
                input,
                "Type:",
                input.SearchType
            });
            try
            {
                if (input.SearchType == SearchType.Statistics)
                {
                    enumerable = this.GenerateKeywordStatsQueryBatches(policy, aggregator, input.Criteria);
                }
                SearchCompletedCallback searchCallback = delegate(ISearchMailboxTask task, ISearchTaskResult result)
                {
                    aggregator.MergeSearchResult(result);
                };
                record.Attributes["MBXCNT"] = list.Count;
                while (list.Count > 0)
                {
                    Recorder.Trace(5L, TraceType.InfoTrace, "LocalSearchResultsProvider.Search UnsearchedSources:", list.Count);
                    HashSet <Guid>  hashSet         = new HashSet <Guid>();
                    MailboxInfoList mailboxInfoList = new MailboxInfoList();
                    int             i = 0;
                    while (i < list.Count)
                    {
                        SearchSource searchSource = list[i];
                        Guid         item         = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveGuid : searchSource.MailboxInfo.MailboxGuid;
                        if (!hashSet.Contains(item))
                        {
                            mailboxInfoList.Add(searchSource.MailboxInfo);
                            list.RemoveAt(i);
                            hashSet.Add(item);
                            databaseGuid = (searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid);
                        }
                        else
                        {
                            i++;
                        }
                    }
                    Recorder.Trace(5L, TraceType.InfoTrace, "LocalSearchResultsProvider.Search NonDuplicateSourcesToSearch:", mailboxInfoList.Count);
                    AggregatedMailboxSearchTask aggregatedMailboxSearchTask;
                    if (input.SearchType == SearchType.Statistics)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "LocalSearchResultsProvider.Search Statistics:", enumerable);
                        using (IEnumerator <List <string> > enumerator = enumerable.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                List <string> keywordList = enumerator.Current;
                                AggregatedMailboxSearchTask aggregatedMailboxSearchTask2;
                                aggregatedMailboxSearchTask = (aggregatedMailboxSearchTask2 = new AggregatedMailboxSearchTask(databaseGuid, mailboxInfoList, input.Criteria, input.PagingInfo, keywordList, input.CallerInfo));
                                try
                                {
                                    aggregatedMailboxSearchTask.Execute(searchCallback);
                                    this.UpdateSearchStatistics(policy, record, aggregatedMailboxSearchTask);
                                }
                                finally
                                {
                                    if (aggregatedMailboxSearchTask2 != null)
                                    {
                                        ((IDisposable)aggregatedMailboxSearchTask2).Dispose();
                                    }
                                }
                            }
                            continue;
                        }
                    }
                    Recorder.Trace(5L, TraceType.InfoTrace, "LocalSearchResultsProvider.Search Regular");
                    AggregatedMailboxSearchTask aggregatedMailboxSearchTask3;
                    aggregatedMailboxSearchTask = (aggregatedMailboxSearchTask3 = new AggregatedMailboxSearchTask(databaseGuid, mailboxInfoList, input.SearchType, input.Criteria, input.PagingInfo, input.CallerInfo));
                    try
                    {
                        aggregatedMailboxSearchTask.Execute(searchCallback);
                        this.UpdateSearchStatistics(policy, record, aggregatedMailboxSearchTask);
                    }
                    finally
                    {
                        if (aggregatedMailboxSearchTask3 != null)
                        {
                            ((IDisposable)aggregatedMailboxSearchTask3).Dispose();
                        }
                    }
                }
            }
            finally
            {
                policy.Recorder.End(record);
            }
            return(new SearchMailboxesResults(input.Sources)
            {
                SearchResult = aggregator
            });
        }
Example #24
0
 public virtual IExchangeProxy GetProxy(ISearchPolicy policy, FanoutParameters parameter)
 {
     Recorder.Trace(2L, TraceType.InfoTrace, "SearchFactory.GetProxy");
     return(new ExchangeProxy(policy, parameter));
 }
Example #25
0
 public Recorder(ISearchPolicy policy)
 {
     this.stopwatch.Start();
     this.policy = policy;
 }
Example #26
0
        public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input)
        {
            ulong            num        = 0UL;
            SortedResultPage resultPage = null;

            new List <SearchSource>(input.Sources);
            List <MailboxStatistics> list = new List <MailboxStatistics>();
            Dictionary <Guid, List <KeyValuePair <int, long> > > dictionary = new Dictionary <Guid, List <KeyValuePair <int, long> > >();

            Recorder.Record record = policy.Recorder.Start("NonIndexableItemProvider", TraceType.InfoTrace, true);
            Recorder.Trace(5L, TraceType.InfoTrace, new object[]
            {
                "NonIndexableItemProvider.Search Input:",
                input,
                "Type:",
                input.SearchType
            });
            try
            {
                SearchSource searchSource = input.Sources.FirstOrDefault <SearchSource>();
                if (searchSource != null)
                {
                    Guid guid = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid;
                    long num2 = 0L;
                    if (input.PagingInfo.SortValue != null && input.PagingInfo.SortValue.SortColumnValue != null)
                    {
                        num2  = input.PagingInfo.SortValue.SecondarySortValue;
                        num2 += 1L;
                    }
                    string indexSystemName = FastIndexVersion.GetIndexSystemName(guid);
                    using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(), indexSystemName))
                    {
                        foreach (SearchSource searchSource2 in input.Sources)
                        {
                            FailedItemParameters failedItemParameters = new FailedItemParameters(FailureMode.All, FieldSet.Default);
                            failedItemParameters.MailboxGuid = new Guid?(searchSource2.MailboxInfo.IsArchive ? searchSource2.MailboxInfo.ArchiveGuid : searchSource2.MailboxInfo.MailboxGuid);
                            long failedItemsCount = failedItemStorage.GetFailedItemsCount(failedItemParameters);
                            num += (ulong)failedItemsCount;
                            list.Add(new MailboxStatistics(searchSource2.MailboxInfo, (ulong)failedItemsCount, ByteQuantifiedSize.Zero));
                            if (input.SearchType == SearchType.NonIndexedItemPreview)
                            {
                                failedItemParameters.StartingIndexId = num2;
                                failedItemParameters.ResultLimit     = input.PagingInfo.PageSize;
                                ICollection <IFailureEntry> failedItems = failedItemStorage.GetFailedItems(failedItemParameters);
                                dictionary[failedItemParameters.MailboxGuid.Value] = (from t in failedItems
                                                                                      select new KeyValuePair <int, long>(t.DocumentId, t.IndexId)).ToList <KeyValuePair <int, long> >();
                            }
                        }
                    }
                    if (input.SearchType == SearchType.NonIndexedItemPreview)
                    {
                        MultiMailboxSearchClient multiMailboxSearchClient = new MultiMailboxSearchClient(guid, (from t in input.Sources
                                                                                                                select t.MailboxInfo).ToArray <MailboxInfo>(), input.Criteria, input.CallerInfo, input.PagingInfo);
                        resultPage = multiMailboxSearchClient.FetchPreviewProperties(dictionary);
                    }
                }
            }
            finally
            {
                policy.Recorder.End(record);
            }
            return(new SearchMailboxesResults(input.Sources)
            {
                SearchResult = new ResultAggregator(resultPage, null, num, ByteQuantifiedSize.Zero, null, null, list)
            });
        }
Example #27
0
 public ExchangeProxy(ISearchPolicy policy, FanoutParameters parameter) : this(policy, parameter.GroupId)
 {
 }