public static async Task <DocumentSearchResult <AzureSearchProviderRequestedFields> > GetProviders(int skip, int take, string universal, List <Filter> filters, bool includeFacets, bool includeTotalCount)
        {
            SearchParameters searchParameters = BuildAzureSearchParameters(skip, take, universal, filters, includeFacets, includeTotalCount);

            ISearchIndexClient indexClient = AzureSearchConnectionCache.GetIndexClient(AzureSearchConnectionCache.IndexNames.providers);
            DocumentSearchResult <AzureSearchProviderRequestedFields> searchResults =
                await indexClient.Documents.SearchAsync <AzureSearchProviderRequestedFields>(universal, searchParameters);

            //List<SearchResult<AzureSearchProviderQueryResponse>> results = searchResults.Results.ToList();

            return(searchResults);
            //results.Select(r => r.Document).ToList();
        }
Exemple #2
0
        public static async Task <List <SuggestionResponse> > GetSuggestions(string azureSearchTerm)
        {
            SearchParameters searchParameters = new SearchParameters
            {
                Select = new[]
                {
                    "id", "firstAndLastName"
                },
                IncludeTotalResultCount = true,
                QueryType    = QueryType.Simple,
                SearchFields = new string[] { "firstAndLastName" },
                Top          = 5
            };

            ISearchIndexClient indexClient = AzureSearchConnectionCache.GetIndexClient(AzureSearchConnectionCache.IndexNames.names);
            DocumentSearchResult <NameIndexDataStructure> searchResults = await indexClient.Documents.SearchAsync <NameIndexDataStructure>(azureSearchTerm, searchParameters);

            List <SearchResult <NameIndexDataStructure> > results = searchResults.Results.ToList();

            List <SuggestionResponse> suggestions = new List <SuggestionResponse>();

            foreach (NameIndexDataStructure c in results.Select(r => r.Document))
            {
                suggestions.Add(new SuggestionResponse
                {
                    Category    = "Name",
                    SubCategory = new SubCategory
                    {
                        Code = null,
                        Text = null
                    },
                    Suggestion = c.firstAndLastName
                });
            }

            return(suggestions);
        }
Exemple #3
0
        public static async Task <List <SuggestionResponse> > GetSuggestions(string azureSearchTerm)
        {
            SearchParameters searchParameters = new SearchParameters
            {
                Select = new[]
                {
                    "id", "isPrimaryCare", "condition"
                },
                IncludeTotalResultCount = true,
                QueryType    = QueryType.Simple,
                SearchFields = new string[] { "condition" },
                Top          = 6
            };

            ISearchIndexClient indexClient = AzureSearchConnectionCache.GetIndexClient(AzureSearchConnectionCache.IndexNames.conditions);
            DocumentSearchResult <ConditionIndexDataStructure> searchResults = await indexClient.Documents.SearchAsync <ConditionIndexDataStructure>(azureSearchTerm, searchParameters);

            List <SearchResult <ConditionIndexDataStructure> > results = searchResults.Results.ToList();

            List <SuggestionResponse> suggestions = new List <SuggestionResponse>();

            foreach (ConditionIndexDataStructure c in results.Select(r => r.Document))
            {
                suggestions.Add(new SuggestionResponse
                {
                    Category    = "Condition",
                    SubCategory = new SubCategory
                    {
                        Code = (c.isPrimaryCare ? "PrimaryCare" : "Specialist"),
                        Text = (c.isPrimaryCare ? "Primary Care Providers" : "Specialists")
                    },
                    Suggestion = c.condition
                });
            }

            return(suggestions);
        }
Exemple #4
0
        public static async Task <List <SuggestionResponse> > GetSuggestions(string azureSearchTerm)
        {
            SearchParameters searchParameters = new SearchParameters
            {
                Select = new[]
                {
                    "id", "specialty", "alias"
                },
                IncludeTotalResultCount = true,
                QueryType    = QueryType.Simple,
                SearchFields = new string[] { "alias" },
                Top          = 5
            };

            ISearchIndexClient indexClient = AzureSearchConnectionCache.GetIndexClient(AzureSearchConnectionCache.IndexNames.specialties);
            DocumentSearchResult <SpecialtyIndexDataStructure> searchResults = await indexClient.Documents.SearchAsync <SpecialtyIndexDataStructure>(azureSearchTerm, searchParameters);

            List <SearchResult <SpecialtyIndexDataStructure> > results = searchResults.Results.ToList();
            List <SuggestionResponse> suggestions = new List <SuggestionResponse>();

            foreach (SpecialtyIndexDataStructure s in results.Select(r => r.Document))
            {
                suggestions.Add(new SuggestionResponse
                {
                    Category    = "Specialty",
                    SubCategory = new SubCategory
                    {
                        Code = "",
                        Text = s.specialty  //If we have a specialty without an alias, do we do the right thing here?  TODO
                    },
                    Suggestion = s.alias
                });
            }

            return(suggestions);
        }