// Token: 0x06001355 RID: 4949 RVA: 0x000778B0 File Offset: 0x00075AB0
 public QueryFilter Execute(string searchString, bool isContentIndexingEnabled, Folder folder, SearchScope searchScope)
 {
     this.searchScope = searchScope;
     this.folderClass = folder.ClassName;
     if (searchString != null)
     {
         this.queryFilter = AqsParser.ParseAndBuildQuery(searchString, SearchFilterGenerator.GetAqsParseOption(folder, isContentIndexingEnabled), this.userCultureInfo, RescopedAll.Default, null, this.policyTagProvider);
     }
     if (this.advancedQueryFilter != null)
     {
         if (this.queryFilter == null)
         {
             this.queryFilter = this.advancedQueryFilter;
         }
         else
         {
             this.queryFilter = new AndFilter(new QueryFilter[]
             {
                 this.queryFilter,
                 this.advancedQueryFilter
             });
         }
     }
     if (this.queryFilter == null)
     {
         return(null);
     }
     this.AddItemTypeFilter();
     return(this.queryFilter);
 }
示例#2
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);
        }
 public QueryFilter Execute(string searchString, bool contentIndexingEnabled, Dictionary <string, bool> folderClass, SearchScope searchScope, CultureInfo cultureInfo)
 {
     if (searchString.Trim().Length == 0)
     {
         return(null);
     }
     this.queryFilter = AqsParser.ParseAndBuildQuery(searchString, AqsParser.ParseOption.SuppressError | (contentIndexingEnabled ? AqsParser.ParseOption.None : AqsParser.ParseOption.ContentIndexingDisabled), cultureInfo, RescopedAll.Default, null, null);
     if (this.queryFilter == null)
     {
         return(null);
     }
     this.AddItemTypeFilter(searchScope, folderClass);
     return(this.queryFilter);
 }
示例#4
0
        internal static string ConvertAqsToKql(string aqsString, CultureInfo culture)
        {
            if (string.IsNullOrEmpty(aqsString))
            {
                return(aqsString);
            }
            Exception   ex          = null;
            QueryFilter queryFilter = null;

            try
            {
                queryFilter = AqsParser.ParseAndBuildQuery(aqsString, AqsParser.ParseOption.UseCiKeywordOnly | AqsParser.ParseOption.DisablePrefixMatch | AqsParser.ParseOption.QueryConverting | AqsParser.ParseOption.AllowShortWildcards, culture, RescopedAll.Default, null, null);
            }
            catch (ParserException ex2)
            {
                ex = ex2;
            }
            if (queryFilter == null)
            {
                throw new MailboxSearchTaskException(Strings.CannotConvertAqsToKql(ex.Message ?? string.Empty));
            }
            string text = null;

            ex = null;
            try
            {
                text = queryFilter.GenerateInfixString(FilterLanguage.Kql);
                QueryFilter aqsFilter = AqsParser.ParseAndBuildQuery(aqsString, AqsParser.ParseOption.UseCiKeywordOnly | AqsParser.ParseOption.DisablePrefixMatch | AqsParser.ParseOption.AllowShortWildcards, culture, RescopedAll.Default, null, null);
                QueryFilter kqlFilter = KqlParser.ParseAndBuildQuery(text, KqlParser.ParseOption.ImplicitOr | KqlParser.ParseOption.UseCiKeywordOnly | KqlParser.ParseOption.DisablePrefixMatch | KqlParser.ParseOption.AllowShortWildcards, culture, RescopedAll.Default, null, null);
                if (!Utils.VerifyQueryFilters(aqsFilter, kqlFilter))
                {
                    throw new MailboxSearchTaskException(Strings.CannotConvertAqsToKql(string.Empty));
                }
            }
            catch (ParserException ex3)
            {
                ex = ex3;
            }
            catch (ArgumentOutOfRangeException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                throw new MailboxSearchTaskException(Strings.CannotConvertAqsToKql(ex.Message));
            }
            return(text);
        }