Skip to content

Instantly share code, notes, and snippets.

@soen
Last active November 28, 2016 20:48
Show Gist options
  • Save soen/82ce5083f590fc69248b92e366cee38d to your computer and use it in GitHub Desktop.
Save soen/82ce5083f590fc69248b92e366cee38d to your computer and use it in GitHub Desktop.
using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext())
{
var results = context.GetQueryable<SearchResultItem>()
.Where(...)
.Skip(0).Take(20)
.GetResults();
var numberOfSearchResults = results.TotalHits;
var searchResuls = results.Hits;
// From here, either return the results and the number of search results
// to the UI, and calculate the number of pages etc., or simply just the
// SearchResults instance - that's up to you.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment