Skip to content

Instantly share code, notes, and snippets.

@fabriciosanchez
Last active March 9, 2020 21:22
Show Gist options
  • Save fabriciosanchez/355b5823b5509a331dbc51a263d840a4 to your computer and use it in GitHub Desktop.
Save fabriciosanchez/355b5823b5509a331dbc51a263d840a4 to your computer and use it in GitHub Desktop.
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