Example #1
0
        public SearchWorkDefinition ParseSearch(ComplianceMessage target, SearchWorkDefinition definition)
        {
            QueryFilter     queryFilter = null;
            string          query       = definition.Query;
            CultureInfo     culture;
            FaultDefinition faultDefinition;

            ExceptionHandler.Parser.TryRun(delegate
            {
                if (string.IsNullOrEmpty(target.Culture))
                {
                    culture = CultureInfo.InvariantCulture;
                }
                else
                {
                    culture = CultureInfo.GetCultureInfo(target.Culture);
                }
                Func <IRecipientResolver, IPolicyTagProvider, QueryFilter> func = null;
                switch (definition.Parser)
                {
                case SearchWorkDefinition.QueryParser.KQL:
                    func = ((IRecipientResolver r, IPolicyTagProvider p) => KqlParser.ParseAndBuildQuery(query, KqlParser.ParseOption.EDiscoveryMode, culture, r, p));
                    break;

                case SearchWorkDefinition.QueryParser.AQS:
                    func = delegate(IRecipientResolver r, IPolicyTagProvider p)
                    {
                        AqsParser.ParseOption parseOption = AqsParser.ParseOption.UseCiKeywordOnly | AqsParser.ParseOption.DisablePrefixMatch | AqsParser.ParseOption.AllowShortWildcards;
                        return(AqsParser.ParseAndBuildQuery(query, parseOption, culture, r, p));
                    };
                    break;
                }
                if (func != null)
                {
                    OrganizationId scopingOrganizationId = null;
                    IPolicyTagProvider arg  = null;
                    IRecipientResolver arg2 = null;
                    if (OrganizationId.TryCreateFromBytes(target.TenantId, Encoding.UTF8, out scopingOrganizationId))
                    {
                        ADSessionSettings adsessionSettings               = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(scopingOrganizationId);
                        adsessionSettings.IncludeInactiveMailbox          = true;
                        IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, adsessionSettings, 146, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs");
                        arg2 = new FastLocalSearchResultsProvider.RecipientIdentityResolver(tenantOrRootOrgRecipientSession);
                        IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 149, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs");
                        arg = new PolicyTagAdProvider(tenantOrTopologyConfigurationSession);
                    }
                    queryFilter = func(arg2, arg);
                }
                if (queryFilter != null)
                {
                    definition.Query = FqlQueryBuilder.ToFqlString(queryFilter, culture);
                }
            }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, null, default(CancellationToken), null, "ParseSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 102);
            if (faultDefinition != null)
            {
                ExceptionHandler.FaultMessage(target, faultDefinition, true);
            }
            return(definition);
        }
Example #2
0
        // Token: 0x06000118 RID: 280 RVA: 0x00006BC0 File Offset: 0x00004DC0
        internal byte[] GetExchangeWorkDefinition()
        {
            SearchWorkDefinition searchWorkDefinition = new SearchWorkDefinition();

            searchWorkDefinition.Parser      = SearchWorkDefinition.QueryParser.KQL;
            searchWorkDefinition.DetailCount = 500;
            searchWorkDefinition.Query       = this.ToKqlQuery();
            WorkPayload workPayload = new WorkPayload();

            workPayload.WorkDefinition     = ComplianceSerializer.Serialize <SearchWorkDefinition>(SearchWorkDefinition.Description, searchWorkDefinition);
            workPayload.WorkDefinitionType = WorkDefinitionType.EDiscovery;
            return(ComplianceSerializer.Serialize <WorkPayload>(WorkPayload.Description, workPayload));
        }
Example #3
0
        public SearchResult PerformSearch(ComplianceMessage target, SearchWorkDefinition definition)
        {
            string          query  = definition.Query;
            SearchResult    result = new SearchResult();
            CultureInfo     culture;
            FaultDefinition faultDefinition;

            ExceptionHandler.Parser.TryRun(delegate
            {
                if (string.IsNullOrEmpty(target.Culture))
                {
                    culture = CultureInfo.InvariantCulture;
                }
                else
                {
                    culture = CultureInfo.GetCultureInfo(target.Culture);
                }
                AdditionalParameters additionalParameters = new AdditionalParameters
                {
                    Refiners = new string[]
                    {
                        FastIndexSystemSchema.Size.Name
                    }
                };
                if (query != null)
                {
                    Guid mailboxGuid = target.MessageTarget.Mailbox;
                    Guid database    = target.MessageTarget.Database;
                    IEnumerable <KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> > pages = null;
                    string flowName = FlowDescriptor.GetImsFlowDescriptor(FastLocalSearchResultsProvider.SearchConfig, FastIndexVersion.GetIndexSystemName(database)).DisplayName;
                    if (ExceptionHandler.Proxy.TryRun(delegate
                    {
                        pages = FastLocalSearchResultsProvider.FlowExecutor.Execute(flowName, mailboxGuid, Guid.NewGuid(), query, 0L, culture, additionalParameters, Math.Min(FastLocalSearchResultsProvider.SearchConfig.FastQueryResultTrimHits, 1), null);
                    }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, new Action <ExceptionHandler.ExceptionData>(this.ProxyExceptionHandler), default(CancellationToken), null, "PerformSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 213))
                    {
                        foreach (KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> keyValuePair in pages)
                        {
                            PagingImsFlowExecutor.QueryExecutionContext key = keyValuePair.Key;
                            SearchResultItem[] value = keyValuePair.Value;
                            ByteQuantifiedSize byteQuantifiedSize = default(ByteQuantifiedSize);
                            long count = 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)
                            {
                                byteQuantifiedSize = new ByteQuantifiedSize((ulong)refinerResult.Sum);
                            }
                            result = new SearchResult();
                            result.UpdateTotalSize((long)byteQuantifiedSize.ToMB());
                            result.UpdateTotalCount(count);
                            result.Results.Add(new SearchResult.TargetSearchResult
                            {
                                Target = target.MessageTarget,
                                Size   = result.TotalSize,
                                Count  = result.TotalCount
                            });
                        }
                    }
                }
            }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, null, default(CancellationToken), null, "PerformSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 188);
            if (faultDefinition != null)
            {
                ExceptionHandler.FaultMessage(target, faultDefinition, true);
            }
            return(result);
        }