Skip to content

Instantly share code, notes, and snippets.

@soen
Last active August 20, 2016 16:18
Show Gist options
  • Save soen/d72a0c23e526c6bea31e7d6816ede584 to your computer and use it in GitHub Desktop.
Save soen/d72a0c23e526c6bea31e7d6816ede584 to your computer and use it in GitHub Desktop.
ISearchIndex index = ContentSearchManager.GetIndex("sitecore_master_index")
using (IProviderSearchContext context = index.CreateSearchContext())
{
// Notice that I've swapped out the 'SearchItemResult' with 'MySearchItemResult'
// in the method call GetQueryable<T>, and now I'm able to use the property
// 'MyTextField' in the filtering
var results = context.GetQueryable<MySearchItemResult>()
.Where(x => x.MyTextField.Contains("Some value"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment