Skip to content

Instantly share code, notes, and snippets.

@gbellmann
Created March 30, 2015 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbellmann/68099cb3d38cdd13d330 to your computer and use it in GitHub Desktop.
Save gbellmann/68099cb3d38cdd13d330 to your computer and use it in GitHub Desktop.
public IEnumerable<Pelicula> SearchDocuments(SearchIndexClient indexClient, string searchText, string filter = null)
{
// Ejecutamos la búsqueda basada en un texto de búsqueda y filtros opcionales
var sp = new SearchParameters();
if (!String.IsNullOrEmpty(filter))
{
sp.Filter = filter;
}
DocumentSearchResponse<Pelicula> response = indexClient.Documents.Search<Pelicula>(searchText, sp);
foreach (SearchResult<Pelicula> result in response)
{
yield return result.Document;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment