-
-
Save sniffdk/4718010 to your computer and use it in GitHub Desktop.
Searching for nodes in the new Umbraco v6 API via Examine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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