public IActionResult EdgeNGram(string searchedContent) { ESReadSuggestionsManager client = new ESReadSuggestionsManager(); var searchResult = client .EdgeNGramSearch(searchedContent); return(Ok(searchResult.Documents)); }
public IActionResult CompletionSuggester(string searchedContent) { ESReadSuggestionsManager client = new ESReadSuggestionsManager(); var searchResult = client .CompletionSuggesterSearch(searchedContent); var results = searchResult.Suggest?.FirstOrDefault().Value?.FirstOrDefault()?.Options?.Select(s => new { Suggestion = s.Text }); return(Ok(results)); }