Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private async Task<ActionResult> RunQueryAsync(SearchData model)
{
InitSearch();
var parameters = new SearchParameters
{
// Enter content property names into this list so only these values will be returned.
// If Select is empty, all values will be returned, which can be inefficient.
Select = new[] { "Column1", "Column2", "ColumnN" }
};
try
{
model.resultList = await _indexClient.Documents.SearchAsync<Content>(model.searchText, parameters);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// Display the results.
return View("Index", model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment