示例#1
0
        static SearchContext CreateContextFromAttribute(SearchContextAttribute attribute)
        {
            var providers = attribute.providerIds.Select(id => SearchService.GetProvider(id))
                            .Concat(attribute.instantiableProviders.Select(type => SearchService.GetProvider(type))).Where(p => p != null);

            if (!providers.Any())
            {
                providers = SearchService.GetObjectProviders();
            }

            var searchText  = attribute.query;
            var searchQuery = GetSearchQueryFromFromAttribute(attribute);

            if (searchQuery != null)
            {
                searchText = searchQuery.text;
                providers  = QuickSearch.GetMergedProviders(providers, searchQuery.providerIds);
            }

            var context = SearchService.CreateContext(providers, searchText);

            return(context);
        }
示例#2
0
 static SearchQueryAsset GetSearchQueryFromFromAttribute(SearchContextAttribute attribute)
 {
     return(GetSearchQueryFromFromAttribute(attribute.query));
 }