Example #1
0
 internal void GenerateSubQueryFilters(IRecipientSession recipientSession, IConfigurationSession configurationSession)
 {
     if (!string.IsNullOrEmpty(this.userQuery))
     {
         SearchMailboxCriteria.RecipientIdentityResolver recipientResolver = null;
         if (recipientSession != null)
         {
             recipientResolver = new SearchMailboxCriteria.RecipientIdentityResolver(recipientSession);
         }
         PolicyTagAdProvider policyTagProvider = null;
         if (configurationSession != null)
         {
             policyTagProvider = new PolicyTagAdProvider(configurationSession);
         }
         QueryFilter queryFilter = KqlParser.ParseAndBuildQuery(this.userQuery, KqlParser.ParseOption.ImplicitOr | KqlParser.ParseOption.UseCiKeywordOnly | KqlParser.ParseOption.DisablePrefixMatch | KqlParser.ParseOption.AllowShortWildcards | KqlParser.ParseOption.EDiscoveryMode, this.QueryCulture, RescopedAll.Default, recipientResolver, policyTagProvider);
         if (queryFilter == null)
         {
             throw new SearchQueryEmptyException();
         }
         ICollection <QueryFilter> collection = null;
         if (queryFilter != null && queryFilter.GetType() == typeof(OrFilter))
         {
             collection = AqsParser.FlattenQueryFilter(queryFilter);
         }
         if (collection != null && collection.Count > 1)
         {
             string      text         = this.searchQuery.Replace(this.userQuery, "");
             QueryFilter queryFilter2 = null;
             if (!string.IsNullOrEmpty(text))
             {
                 queryFilter2 = KqlParser.ParseAndBuildQuery(text, KqlParser.ParseOption.ImplicitOr | KqlParser.ParseOption.UseCiKeywordOnly | KqlParser.ParseOption.DisablePrefixMatch | KqlParser.ParseOption.AllowShortWildcards | KqlParser.ParseOption.EDiscoveryMode, this.QueryCulture, RescopedAll.Default, recipientResolver, policyTagProvider);
             }
             this.subfilters = new Dictionary <string, QueryFilter>(collection.Count);
             int num = 0;
             foreach (QueryFilter queryFilter3 in collection)
             {
                 string      keywordPhrase = MailboxDiscoverySearch.GetKeywordPhrase(queryFilter3, this.userQuery, ref num);
                 QueryFilter value;
                 if (queryFilter2 == null)
                 {
                     value = queryFilter3;
                 }
                 else
                 {
                     value = new AndFilter(new QueryFilter[]
                     {
                         queryFilter2,
                         queryFilter3
                     });
                 }
                 if (!this.subfilters.ContainsKey(keywordPhrase))
                 {
                     this.subfilters.Add(keywordPhrase, value);
                 }
             }
         }
     }
 }
Example #2
0
        internal void ResolveQueryFilter(IRecipientSession recipientSession, IConfigurationSession configurationSession)
        {
            SearchMailboxCriteria.RecipientIdentityResolver recipientResolver = null;
            if (recipientSession != null)
            {
                recipientResolver = new SearchMailboxCriteria.RecipientIdentityResolver(recipientSession);
            }
            PolicyTagAdProvider policyTagProvider = null;

            if (configurationSession != null)
            {
                policyTagProvider = new PolicyTagAdProvider(configurationSession);
            }
            if (this.SearchQuery != null)
            {
                this.searchFilter = KqlParser.ParseAndBuildQuery(this.SearchQuery, KqlParser.ParseOption.ImplicitOr | KqlParser.ParseOption.UseCiKeywordOnly | KqlParser.ParseOption.DisablePrefixMatch | KqlParser.ParseOption.AllowShortWildcards | KqlParser.ParseOption.EDiscoveryMode, this.QueryCulture, RescopedAll.Default, recipientResolver, policyTagProvider);
                if (this.searchFilter == null)
                {
                    throw new SearchQueryEmptyException();
                }
            }
            SearchMailboxCriteria.Tracer.TraceDebug <QueryFilter>((long)this.GetHashCode(), "SearchMailboxCriteria resolved QueryFilter:{0}", this.searchFilter);
        }