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); } } } } }
private IDictionary <string, QueryFilter> GetSubFilters(QueryFilter filter) { if (filter == null) { return(null); } if (!(filter.GetType() == typeof(OrFilter))) { return(null); } IDictionary <string, QueryFilter> subQueryString = this.GetSubQueryString(AqsParser.FlattenQueryFilter(filter)); if (subQueryString != null && subQueryString.Count == 1) { Factory.Current.LocalTaskTracer.TraceInformation <Guid, string>(this.GetHashCode(), 0L, "Correlation Id:{0}. The query filter {1} is an OrFilter, but it only returns one sub filter.", this.queryCorrelationId, filter.ToString()); return(null); } return(subQueryString); }