Skip to content

Instantly share code, notes, and snippets.

@sniffdk
Forked from mattbrailsford/Testimonials.cs
Last active December 12, 2015 04:58
Show Gist options
  • Save sniffdk/4718010 to your computer and use it in GitHub Desktop.
Save sniffdk/4718010 to your computer and use it in GitHub Desktop.
Searching for nodes in the new Umbraco v6 API via Examine
// It's properly more correct to search on NodeTypeAlias (or DocumentTypeAlias as it's called in the new API)
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile();
var testimonials = Model.Content.AncestorOrSelf(1)
.Sibling("Repository")
.Search(criteria);
// Or perhaps even just this, no traversing is need, performance should be the same, as nodes in Lucene aren't hierarchically stored
var criteria = ExamineManager.Instance.DefaultSearchProvider.CreateSearchCriteria().NodeTypeAlias("Testimonial").Compile();
var testimonials = Model.Content.Search(criteria);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment