Skip to content

Instantly share code, notes, and snippets.

@dampee
Last active May 18, 2017 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dampee/1a8b03dbfcf7c1bc8cd2beea8662b3d4 to your computer and use it in GitHub Desktop.
Save dampee/1a8b03dbfcf7c1bc8cd2beea8662b3d4 to your computer and use it in GitHub Desktop.
Search media on nodename without descendants
var internalSearchProvider = ExamineManager.Instance.SearchProviderCollection["InternalSearcher"];
var query = ExamineManager.Instance.CreateSearchCriteria()
.NodeTypeAlias("image")
.And().NodeName("Desert.jpg".ToLowerInvariant())
.Compile();
var results = Umbraco.TypedSearch(query, internalSearchProvider);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment